mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-26 17:05:01 +00:00
Merge pull request #167 from AtlasMediaGroup/whoops
Fixes an oopsie I made whilst sleep deprived
This commit is contained in:
commit
3f690e2ca1
@ -276,17 +276,14 @@ public class CoreProtectBridge extends FreedomService
|
||||
Block block = event.getClickedBlock();
|
||||
final CoreProtectAPI coreProtect = getCoreProtectAPI();
|
||||
|
||||
// TODO: Rewrite this
|
||||
if (data.hasInspection())
|
||||
{
|
||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK)
|
||||
{
|
||||
if (block != null)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
if (!plugin.al.isAdmin(player))
|
||||
@ -364,8 +367,6 @@ public class CoreProtectBridge extends FreedomService
|
||||
else if (event.getAction() == Action.RIGHT_CLICK_BLOCK)
|
||||
{
|
||||
if (block != null)
|
||||
{
|
||||
if (data.hasInspection())
|
||||
{
|
||||
BlockState blockState = block.getRelative(event.getBlockFace()).getState();
|
||||
Block placedBlock = blockState.getBlock();
|
||||
@ -377,19 +378,6 @@ public class CoreProtectBridge extends FreedomService
|
||||
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))
|
||||
{
|
||||
cooldown.put(player.getName(), System.currentTimeMillis());
|
||||
@ -455,4 +443,3 @@ public class CoreProtectBridge extends FreedomService
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user