mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +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();
|
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());
|
||||||
@ -455,4 +443,3 @@ public class CoreProtectBridge extends FreedomService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user