mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Whoops
This commit fixes 2 things: 1. A redundant check that was completely unnecessary 2. A loophole in my original bugfix commit I didn't initially discover until afterwards which enables players to do the same thing except with right clicking instead The block inspector should be completely rewritten in the future, but for now it works.
This commit is contained in:
parent
a728ec24d4
commit
abfa3b977c
@ -276,17 +276,14 @@ public class CoreProtectBridge extends FreedomService
|
|||||||
Block block = event.getClickedBlock();
|
Block block = event.getClickedBlock();
|
||||||
final CoreProtectAPI coreProtect = getCoreProtectAPI();
|
final CoreProtectAPI coreProtect = getCoreProtectAPI();
|
||||||
|
|
||||||
|
// TODO: Rewrite this
|
||||||
if (data.hasInspection())
|
if (data.hasInspection())
|
||||||
{
|
{
|
||||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK)
|
|
||||||
{
|
|
||||||
if (block != null)
|
|
||||||
{
|
|
||||||
event.setCancelled(true);
|
|
||||||
|
|
||||||
int cooldownTime = 3;
|
int cooldownTime = 3;
|
||||||
|
|
||||||
if (cooldown.containsKey(player.getName()))
|
// Cooldown check
|
||||||
|
if ((event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK)
|
||||||
|
&& cooldown.containsKey(player.getName()))
|
||||||
{
|
{
|
||||||
long secondsLeft = getSecondsLeft(cooldown.get(player.getName()), cooldownTime);
|
long secondsLeft = getSecondsLeft(cooldown.get(player.getName()), cooldownTime);
|
||||||
if (secondsLeft > 0L)
|
if (secondsLeft > 0L)
|
||||||
@ -297,6 +294,12 @@ public class CoreProtectBridge extends FreedomService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Actual lookup time
|
||||||
|
if (event.getAction() == Action.LEFT_CLICK_BLOCK)
|
||||||
|
{
|
||||||
|
if (block != null)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
List<String[]> lookup = coreProtect.blockLookup(block, -1);
|
List<String[]> lookup = coreProtect.blockLookup(block, -1);
|
||||||
|
|
||||||
if (!plugin.al.isAdmin(player))
|
if (!plugin.al.isAdmin(player))
|
||||||
@ -364,8 +367,6 @@ public class CoreProtectBridge extends FreedomService
|
|||||||
else if (event.getAction() == Action.RIGHT_CLICK_BLOCK)
|
else if (event.getAction() == Action.RIGHT_CLICK_BLOCK)
|
||||||
{
|
{
|
||||||
if (block != null)
|
if (block != null)
|
||||||
{
|
|
||||||
if (data.hasInspection())
|
|
||||||
{
|
{
|
||||||
BlockState blockState = block.getRelative(event.getBlockFace()).getState();
|
BlockState blockState = block.getRelative(event.getBlockFace()).getState();
|
||||||
Block placedBlock = blockState.getBlock();
|
Block placedBlock = blockState.getBlock();
|
||||||
@ -377,19 +378,6 @@ public class CoreProtectBridge extends FreedomService
|
|||||||
lookup = coreProtect.blockLookup(block, -1);
|
lookup = coreProtect.blockLookup(block, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int cooldownTime = 3;
|
|
||||||
|
|
||||||
if (cooldown.containsKey(player.getName()))
|
|
||||||
{
|
|
||||||
long secondsLeft = getSecondsLeft(cooldown.get(player.getName()), cooldownTime);
|
|
||||||
if (secondsLeft > 0L)
|
|
||||||
{
|
|
||||||
event.setCancelled(true);
|
|
||||||
player.sendMessage(ChatColor.RED + String.valueOf(secondsLeft) + " seconds left before next query.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!plugin.al.isAdmin(player))
|
if (!plugin.al.isAdmin(player))
|
||||||
{
|
{
|
||||||
cooldown.put(player.getName(), System.currentTimeMillis());
|
cooldown.put(player.getName(), System.currentTimeMillis());
|
||||||
@ -454,5 +442,4 @@ public class CoreProtectBridge extends FreedomService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user