Finish fixing multiple clicks being handled
This commit is contained in:
parent
bef8f89f97
commit
c5637d7c44
3 changed files with 3 additions and 24 deletions
|
@ -53,7 +53,7 @@ mod_name=Zontreck Library Mod
|
|||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=GPLv3
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=1.10.011524.0036
|
||||
mod_version=1.10.011524.0045
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
|
|
|
@ -162,7 +162,7 @@ public class ChestGUIButton
|
|||
*/
|
||||
public void clicked()
|
||||
{
|
||||
if(Instant.now().getEpochSecond() > (lastInvoked + 3))
|
||||
if(Instant.now().getEpochSecond() > (lastInvoked + 1))
|
||||
{
|
||||
|
||||
lastInvoked = Instant.now().getEpochSecond();
|
||||
|
|
|
@ -15,21 +15,6 @@ public class ChestGUIReadOnlyStackHandler extends ItemStackHandler
|
|||
{
|
||||
private ChestGUI gui;
|
||||
private Player player;
|
||||
private long lastClickTime;
|
||||
private int lastClickStack=-1;
|
||||
|
||||
public boolean validClick(int slot)
|
||||
{
|
||||
if(lastClickStack != slot)return true;
|
||||
else{
|
||||
if(Instant.now().getEpochSecond() > (lastClickTime + 3))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public ChestGUIReadOnlyStackHandler(ChestGUI gui, Player player)
|
||||
{
|
||||
|
@ -90,14 +75,8 @@ public class ChestGUIReadOnlyStackHandler extends ItemStackHandler
|
|||
|
||||
if(btn == null) return ItemStack.EMPTY;
|
||||
|
||||
if(validClick(slot))
|
||||
{
|
||||
btn.clicked();
|
||||
|
||||
lastClickTime = Instant.now().getEpochSecond();
|
||||
lastClickStack = slot;
|
||||
}
|
||||
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue