Let Throwing TNT be thrown with Right Click, prevent 2x use from TNT/Compass

This commit is contained in:
Spencer 2017-12-31 20:13:18 -05:00 committed by Alexander Meech
parent d1c147b025
commit c31e387b2a
1 changed files with 18 additions and 3 deletions

View File

@ -20,6 +20,7 @@ import org.bukkit.Color;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type; import org.bukkit.FireworkEffect.Type;
import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -46,6 +47,7 @@ import org.bukkit.entity.Snowball;
import org.bukkit.entity.TNTPrimed; import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockBurnEvent; import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockFadeEvent; import org.bukkit.event.block.BlockFadeEvent;
@ -130,6 +132,7 @@ import nautilus.game.arcade.game.games.survivalgames.kit.KitHorseman;
import nautilus.game.arcade.game.games.survivalgames.kit.KitKnight; import nautilus.game.arcade.game.games.survivalgames.kit.KitKnight;
import nautilus.game.arcade.game.games.survivalgames.kit.KitLooter; import nautilus.game.arcade.game.games.survivalgames.kit.KitLooter;
import nautilus.game.arcade.game.games.survivalgames.kit.KitNecromancer; import nautilus.game.arcade.game.games.survivalgames.kit.KitNecromancer;
import nautilus.game.arcade.game.games.survivalgames.kit.KitScavenger;
import nautilus.game.arcade.game.modules.winstreak.WinStreakModule; import nautilus.game.arcade.game.modules.winstreak.WinStreakModule;
import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
@ -206,6 +209,8 @@ public abstract class SurvivalGames extends Game
new KitBarbarian(manager), new KitBarbarian(manager),
new KitHorseman(manager), new KitHorseman(manager),
new KitScavenger(manager)
}, type, description); }, type, description);
} }
@ -1005,6 +1010,11 @@ public abstract class SurvivalGames extends Game
if (item == null || item.getType() != Material.COMPASS) if (item == null || item.getType() != Material.COMPASS)
return; return;
if (!Recharge.Instance.use(player, "Use Compass", 2500, true, true))
{
return;
}
int uses = Integer.parseInt(ChatColor.stripColor( int uses = Integer.parseInt(ChatColor.stripColor(
item.getItemMeta().getLore().get(0)).replaceAll("\\D+", "")); item.getItemMeta().getLore().get(0)).replaceAll("\\D+", ""));
@ -1940,8 +1950,13 @@ public abstract class SurvivalGames extends Game
if (!IsLive()) if (!IsLive())
return; return;
if (!UtilEvent.isAction(event, ActionType.L)) if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock() != null)
return; {
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
}
}
Player player = event.getPlayer(); Player player = event.getPlayer();
@ -1953,7 +1968,7 @@ public abstract class SurvivalGames extends Game
event.setCancelled(true); event.setCancelled(true);
if (!Recharge.Instance.use(player, "Throw TNT", 0, true, false)) if (!Recharge.Instance.use(player, "Throw TNT", 250, true, false))
{ {
UtilPlayer.message( UtilPlayer.message(
event.getPlayer(), event.getPlayer(),