1.3.0 beta 2, bug fixes, added more block settings, added more config options
This commit is contained in:
parent
5306f09eb0
commit
4995dc3544
7 changed files with 254 additions and 105 deletions
|
@ -1,67 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.scoreboard.Scoreboard;
|
|
||||||
import org.bukkit.scoreboard.Team;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import net.tylermurphy.hideAndSeek.Main;
|
|
||||||
|
|
||||||
public class Store {
|
|
||||||
|
|
||||||
public static Map<String,Player> playerList = new HashMap<String,Player>();
|
|
||||||
|
|
||||||
public static Scoreboard board;
|
|
||||||
public static Team Hider,Seeker,Spectator;
|
|
||||||
|
|
||||||
public static String status = "Setup";
|
|
||||||
|
|
||||||
public static String messagePrefix = String.format("%sHide and Seek > %s", ChatColor.BLUE, ChatColor.WHITE);
|
|
||||||
public static String errorPrefix = String.format("%sError > %s", ChatColor.RED, ChatColor.WHITE);
|
|
||||||
|
|
||||||
public static Vector spawnPosition;
|
|
||||||
|
|
||||||
public static Vector worldborderPosition;
|
|
||||||
public static int worldborderSize,worldborderDelay,currentWorldborderSize;
|
|
||||||
public static boolean worldborderEnabled = false, decreaseBorder = false;
|
|
||||||
|
|
||||||
public static List<String> blockedCommands;
|
|
||||||
|
|
||||||
public static String tauntPlayer = "";
|
|
||||||
|
|
||||||
public static int glowTime = 0;
|
|
||||||
|
|
||||||
public static int gameId = 0;
|
|
||||||
|
|
||||||
public static FileConfiguration getConfig() {
|
|
||||||
return Main.plugin.getConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void saveConfig() {
|
|
||||||
Main.plugin.saveConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void loadConfig() {
|
|
||||||
ConfigurationSection spawnConfig = getConfig().getConfigurationSection("spawn");
|
|
||||||
if(spawnConfig == null) spawnConfig = getConfig().createSection("spawn");
|
|
||||||
spawnPosition = new Vector(spawnConfig.getDouble("x", 0), spawnConfig.getDouble("y", 0), spawnConfig.getDouble("z", 0));
|
|
||||||
getConfig().createSection("spawn", spawnConfig.getValues(true));
|
|
||||||
ConfigurationSection worldBorderConfig = getConfig().getConfigurationSection("worldBorder");
|
|
||||||
if(worldBorderConfig == null) worldBorderConfig = getConfig().createSection("worldBorder");
|
|
||||||
worldborderPosition = new Vector(worldBorderConfig.getInt("x", 0), 0, worldBorderConfig.getInt("z", 0));
|
|
||||||
worldborderSize = worldBorderConfig.getInt("x", 500);
|
|
||||||
worldborderEnabled = worldBorderConfig.getBoolean("enabled", false);
|
|
||||||
getConfig().createSection("worldBorder", worldBorderConfig.getValues(true));
|
|
||||||
getConfig().addDefault("blockedCommands", new ArrayList<String>());
|
|
||||||
blockedCommands = getConfig().getStringList("blockedCommands");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -36,16 +36,22 @@ public class CommandHandler {
|
||||||
public static boolean handleCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
public static boolean handleCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
if(sender instanceof Player == false) {
|
if(sender instanceof Player == false) {
|
||||||
sender.sendMessage(errorPrefix + "This command can only be run as a player.");
|
sender.sendMessage(errorPrefix + "This command can only be run as a player.");
|
||||||
} else if(args.length < 1) {
|
} else if(args.length < 1 || !COMMAND_REGISTER.containsKey(args[0].toLowerCase()) ) {
|
||||||
COMMAND_REGISTER.get("about").execute(sender, new String[0]);
|
if(permissionsRequired && !sender.hasPermission("hideandseek.about")) {
|
||||||
} else if(!COMMAND_REGISTER.containsKey(args[0].toLowerCase())) {
|
sender.sendMessage(errorPrefix + "You are not allowed to run this command.");
|
||||||
COMMAND_REGISTER.get("about").execute(sender, Arrays.copyOfRange(args, 1, args.length));
|
} else {
|
||||||
|
COMMAND_REGISTER.get("about").execute(sender, null);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
if(permissionsRequired && !sender.hasPermission("hideandseek."+args[0].toLowerCase())) {
|
||||||
COMMAND_REGISTER.get(args[0].toLowerCase()).execute(sender,Arrays.copyOfRange(args, 1, args.length));
|
sender.sendMessage(errorPrefix + "You are not allowed to run this command.");
|
||||||
} catch (Exception e) {
|
} else {
|
||||||
sender.sendMessage(errorPrefix + "An error has occured.");
|
try {
|
||||||
e.printStackTrace();
|
COMMAND_REGISTER.get(args[0].toLowerCase()).execute(sender,Arrays.copyOfRange(args, 1, args.length));
|
||||||
|
} catch (Exception e) {
|
||||||
|
sender.sendMessage(errorPrefix + "An error has occured.");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -15,31 +15,56 @@ import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class Store {
|
public class Store {
|
||||||
|
|
||||||
public static Map<String,Player> playerList = new HashMap<String,Player>();
|
public static Map<String,Player>
|
||||||
|
playerList = new HashMap<String,Player>();
|
||||||
|
|
||||||
public static Scoreboard board;
|
public static Scoreboard
|
||||||
public static Team Hider,Seeker,Spectator;
|
board;
|
||||||
|
|
||||||
public static String status = "Setup";
|
public static Team
|
||||||
|
Hider,
|
||||||
|
Seeker,
|
||||||
|
Spectator;
|
||||||
|
|
||||||
public static String messagePrefix,errorPrefix,tauntPrefix,worldborderPrefix,abortPrefix,gameoverPrefix;
|
public static String
|
||||||
|
messagePrefix,
|
||||||
|
errorPrefix,
|
||||||
|
tauntPrefix,
|
||||||
|
worldborderPrefix,
|
||||||
|
abortPrefix,
|
||||||
|
gameoverPrefix,
|
||||||
|
spawnWorld,
|
||||||
|
status = "Setup",
|
||||||
|
tauntPlayer = "";
|
||||||
|
|
||||||
public static Vector spawnPosition;
|
public static Vector
|
||||||
public static String spawnWorld;
|
spawnPosition,
|
||||||
|
worldborderPosition;
|
||||||
|
|
||||||
public static Vector worldborderPosition;
|
public static List<String>
|
||||||
public static int worldborderSize,worldborderDelay,currentWorldborderSize;
|
blockedCommands;
|
||||||
public static boolean worldborderEnabled = false, decreaseBorder = false;
|
|
||||||
|
|
||||||
public static List<String> blockedCommands;
|
public static boolean
|
||||||
|
nametagsVisible,
|
||||||
|
permissionsRequired,
|
||||||
|
unbreakableArmorstands,
|
||||||
|
unbreakablePaintings,
|
||||||
|
unbreakableItemframes,
|
||||||
|
interactableArmorstands,
|
||||||
|
interactableItemframes,
|
||||||
|
interactableDoors,
|
||||||
|
interactableTrapdoors,
|
||||||
|
interactableFencegate,
|
||||||
|
worldborderEnabled = false,
|
||||||
|
decreaseBorder = false;
|
||||||
|
|
||||||
public static boolean nametagsVisible;
|
public static int
|
||||||
|
minPlayers,
|
||||||
public static String tauntPlayer = "";
|
glowTime = 0,
|
||||||
|
gameId = 0,
|
||||||
public static int glowTime = 0;
|
worldborderSize,
|
||||||
|
worldborderDelay,
|
||||||
public static int gameId = 0;
|
currentWorldborderSize;
|
||||||
|
|
||||||
public static FileConfiguration getConfig() {
|
public static FileConfiguration getConfig() {
|
||||||
return Main.plugin.getConfig();
|
return Main.plugin.getConfig();
|
||||||
|
@ -53,6 +78,7 @@ public class Store {
|
||||||
|
|
||||||
Main.plugin.reloadConfig();
|
Main.plugin.reloadConfig();
|
||||||
|
|
||||||
|
//Default
|
||||||
getConfig().addDefault("spawn.x", 0);
|
getConfig().addDefault("spawn.x", 0);
|
||||||
getConfig().addDefault("spawn.y", 0);
|
getConfig().addDefault("spawn.y", 0);
|
||||||
getConfig().addDefault("spawn.z", 0);
|
getConfig().addDefault("spawn.z", 0);
|
||||||
|
@ -70,25 +96,37 @@ public class Store {
|
||||||
getConfig().addDefault("prefix.abort", "&cAbort > &f");
|
getConfig().addDefault("prefix.abort", "&cAbort > &f");
|
||||||
getConfig().addDefault("prefix.gameover", "&aGame Over > &f");
|
getConfig().addDefault("prefix.gameover", "&aGame Over > &f");
|
||||||
getConfig().addDefault("nametagsVisible", false);
|
getConfig().addDefault("nametagsVisible", false);
|
||||||
|
getConfig().addDefault("permissionsRequired", true);
|
||||||
|
getConfig().addDefault("blockSettings.unbreakable.painting", false);
|
||||||
|
getConfig().addDefault("blockSettings.unbreakable.armorstand", false);
|
||||||
|
getConfig().addDefault("blockSettings.unbreakable.itemframe", false);
|
||||||
|
getConfig().addDefault("blockSettings.interactable.armorstand", true);
|
||||||
|
getConfig().addDefault("blockSettings.interactable.itemframe", true);
|
||||||
|
getConfig().addDefault("blockSettings.interactable.door", true);
|
||||||
|
getConfig().addDefault("blockSettings.interactable.trapdoor", true);
|
||||||
|
getConfig().addDefault("blockSettings.interactable.fence", true);
|
||||||
|
getConfig().addDefault("minPlayers", 2);
|
||||||
|
|
||||||
|
//Spawn
|
||||||
spawnPosition = new Vector(
|
spawnPosition = new Vector(
|
||||||
getConfig().getDouble("spawn.x"),
|
getConfig().getDouble("spawn.x"),
|
||||||
getConfig().getDouble("spawn.y"),
|
Math.max(0,Math.min(255,getConfig().getDouble("spawn.y"))),
|
||||||
getConfig().getDouble("spawn.z")
|
getConfig().getDouble("spawn.z")
|
||||||
);
|
);
|
||||||
spawnWorld = getConfig().getString("spawn.world");
|
spawnWorld = getConfig().getString("spawn.world");
|
||||||
|
|
||||||
|
//World border
|
||||||
worldborderPosition = new Vector(
|
worldborderPosition = new Vector(
|
||||||
getConfig().getInt("worldBorder.x"),
|
getConfig().getInt("worldBorder.x"),
|
||||||
0,
|
0,
|
||||||
getConfig().getInt("worldBorder.z")
|
getConfig().getInt("worldBorder.z")
|
||||||
);
|
);
|
||||||
worldborderSize = getConfig().getInt("worldBorder.size");
|
worldborderSize = Math.max(100,getConfig().getInt("worldBorder.size"));
|
||||||
worldborderDelay = getConfig().getInt("worldBorder.delay");
|
worldborderDelay = Math.max(1,getConfig().getInt("worldBorder.delay"));
|
||||||
worldborderEnabled = getConfig().getBoolean("worldBorder.enabled");
|
worldborderEnabled = getConfig().getBoolean("worldBorder.enabled");
|
||||||
|
|
||||||
blockedCommands = getConfig().getStringList("blockedCommands");
|
blockedCommands = getConfig().getStringList("blockedCommands");
|
||||||
|
|
||||||
|
//Prefix
|
||||||
char SYMBOLE = '\u00A7';
|
char SYMBOLE = '\u00A7';
|
||||||
String SYMBOLE_STRING = new String(new char[] {SYMBOLE});
|
String SYMBOLE_STRING = new String(new char[] {SYMBOLE});
|
||||||
|
|
||||||
|
@ -99,13 +137,26 @@ public class Store {
|
||||||
abortPrefix = getConfig().getString("prefix.abort").replace("&", SYMBOLE_STRING);
|
abortPrefix = getConfig().getString("prefix.abort").replace("&", SYMBOLE_STRING);
|
||||||
gameoverPrefix = getConfig().getString("prefix.gameover").replace("&", SYMBOLE_STRING);
|
gameoverPrefix = getConfig().getString("prefix.gameover").replace("&", SYMBOLE_STRING);
|
||||||
|
|
||||||
|
//Other
|
||||||
nametagsVisible = getConfig().getBoolean("nametagsVisible");
|
nametagsVisible = getConfig().getBoolean("nametagsVisible");
|
||||||
|
permissionsRequired = getConfig().getBoolean("permissionsRequired");
|
||||||
|
unbreakablePaintings = getConfig().getBoolean("blockSettings.unbreakable.painting");
|
||||||
|
unbreakableArmorstands = getConfig().getBoolean("blockSettings.unbreakable.armorstand");
|
||||||
|
unbreakableItemframes = getConfig().getBoolean("blockSettings.unbreakable.itemframe");
|
||||||
|
interactableArmorstands = getConfig().getBoolean("blockSettings.interactable.armorstand");
|
||||||
|
interactableItemframes = getConfig().getBoolean("blockSettings.interactable.itemframe");
|
||||||
|
interactableDoors = getConfig().getBoolean("blockSettings.interactable.door");
|
||||||
|
interactableTrapdoors = getConfig().getBoolean("blockSettings.interactable.trapdoor");
|
||||||
|
interactableFencegate = getConfig().getBoolean("blockSettings.interactable.fence");
|
||||||
|
minPlayers = Math.max(2,getConfig().getInt("minPlayers"));
|
||||||
|
|
||||||
getConfig().options().copyDefaults(true);
|
getConfig().options().copyDefaults(true);
|
||||||
saveConfig();
|
saveConfig();
|
||||||
|
|
||||||
if(spawnPosition.getBlockX() != 0 || spawnPosition.getBlockY() != 0 || spawnPosition.getBlockZ() != 0) {
|
if(spawnPosition.getBlockX() != 0 || spawnPosition.getBlockY() != 0 || spawnPosition.getBlockZ() != 0) {
|
||||||
status = "Standby";
|
if(status.equals("Setup")) {
|
||||||
|
status = "Standby";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ public class Help implements ICommand {
|
||||||
for(ICommand command : CommandHandler.COMMAND_REGISTER.values()) {
|
for(ICommand command : CommandHandler.COMMAND_REGISTER.values()) {
|
||||||
message += String.format("%s/hs %s%s %s%s\n %s%s%s", ChatColor.AQUA, ChatColor.WHITE, command.getLabel().toLowerCase(), ChatColor.BLUE, command.getUsage(), ChatColor.GRAY, ChatColor.ITALIC, command.getDescription()+"\n");
|
message += String.format("%s/hs %s%s %s%s\n %s%s%s", ChatColor.AQUA, ChatColor.WHITE, command.getLabel().toLowerCase(), ChatColor.BLUE, command.getUsage(), ChatColor.GRAY, ChatColor.ITALIC, command.getDescription()+"\n");
|
||||||
}
|
}
|
||||||
message = message.substring(0, message.length()-2);
|
message = message.substring(0, message.length()-1);
|
||||||
sender.sendMessage(message);
|
sender.sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,8 @@ public class Start implements ICommand {
|
||||||
sender.sendMessage(errorPrefix + "Game is already in session");
|
sender.sendMessage(errorPrefix + "Game is already in session");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(playerList.size() < 2) {
|
if(playerList.size() < minPlayers) {
|
||||||
sender.sendMessage(errorPrefix + "You must have at least 2 players to start");
|
sender.sendMessage(errorPrefix + "You must have at least "+minPlayers+" players to start");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,16 +8,23 @@ import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
|
import org.bukkit.entity.ArmorStand;
|
||||||
|
import org.bukkit.entity.ItemFrame;
|
||||||
|
import org.bukkit.entity.Painting;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Snowball;
|
import org.bukkit.entity.Snowball;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||||
|
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
@ -54,7 +61,7 @@ public class EventListener implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerDamage(EntityDamageEvent event) {
|
public void onEntityDamage(EntityDamageEvent event) {
|
||||||
if(event.getEntity() instanceof Player) {
|
if(event.getEntity() instanceof Player) {
|
||||||
if(!status.equals("Playing")) {
|
if(!status.equals("Playing")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -80,6 +87,124 @@ public class EventListener implements Listener {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||||
|
if(event.getEntity() instanceof ArmorStand) {
|
||||||
|
if(unbreakableArmorstands) {
|
||||||
|
if(event.getDamager() instanceof Player) {
|
||||||
|
Player player = (Player) event.getDamager();
|
||||||
|
if(status.equals("Playing") || status.equals("Starting") || !player.hasPermission("hideandseek.blockbypass")) {
|
||||||
|
System.out.println('t');
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
||||||
|
if(!interactableArmorstands) {
|
||||||
|
if(event.getRightClicked() instanceof ArmorStand) {
|
||||||
|
if(status.equals("Playing") || status.equals("Starting") || !event.getPlayer().hasPermission("hideandseek.blockbypass")) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!interactableItemframes) {
|
||||||
|
if(event.getRightClicked() instanceof ItemFrame) {
|
||||||
|
if(status.equals("Playing") || status.equals("Starting") || !event.getPlayer().hasPermission("hideandseek.blockbypass")) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerInteractBlock(PlayerInteractEvent event) {
|
||||||
|
if(!interactableDoors) {
|
||||||
|
if(
|
||||||
|
event.getClickedBlock().getType() == Material.ACACIA_DOOR ||
|
||||||
|
event.getClickedBlock().getType() == Material.BIRCH_DOOR ||
|
||||||
|
event.getClickedBlock().getType() == Material.CRIMSON_DOOR ||
|
||||||
|
event.getClickedBlock().getType() == Material.DARK_OAK_DOOR ||
|
||||||
|
event.getClickedBlock().getType() == Material.IRON_DOOR ||
|
||||||
|
event.getClickedBlock().getType() == Material.JUNGLE_DOOR ||
|
||||||
|
event.getClickedBlock().getType() == Material.OAK_DOOR ||
|
||||||
|
event.getClickedBlock().getType() == Material.SPRUCE_DOOR ||
|
||||||
|
event.getClickedBlock().getType() == Material.WARPED_DOOR
|
||||||
|
) {
|
||||||
|
if(status.equals("Playing") || status.equals("Starting") || !event.getPlayer().hasPermission("hideandseek.blockbypass")) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!interactableTrapdoors) {
|
||||||
|
if(
|
||||||
|
event.getClickedBlock().getType() == Material.ACACIA_TRAPDOOR ||
|
||||||
|
event.getClickedBlock().getType() == Material.BIRCH_TRAPDOOR ||
|
||||||
|
event.getClickedBlock().getType() == Material.CRIMSON_TRAPDOOR ||
|
||||||
|
event.getClickedBlock().getType() == Material.DARK_OAK_TRAPDOOR ||
|
||||||
|
event.getClickedBlock().getType() == Material.IRON_TRAPDOOR ||
|
||||||
|
event.getClickedBlock().getType() == Material.JUNGLE_TRAPDOOR ||
|
||||||
|
event.getClickedBlock().getType() == Material.OAK_TRAPDOOR ||
|
||||||
|
event.getClickedBlock().getType() == Material.SPRUCE_TRAPDOOR ||
|
||||||
|
event.getClickedBlock().getType() == Material.WARPED_TRAPDOOR
|
||||||
|
) {
|
||||||
|
if(status.equals("Playing") || status.equals("Starting") || !event.getPlayer().hasPermission("hideandseek.blockbypass")) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!interactableFencegate) {
|
||||||
|
if(
|
||||||
|
event.getClickedBlock().getType() == Material.ACACIA_FENCE_GATE ||
|
||||||
|
event.getClickedBlock().getType() == Material.BIRCH_FENCE_GATE ||
|
||||||
|
event.getClickedBlock().getType() == Material.CRIMSON_FENCE_GATE ||
|
||||||
|
event.getClickedBlock().getType() == Material.DARK_OAK_FENCE_GATE ||
|
||||||
|
event.getClickedBlock().getType() == Material.JUNGLE_FENCE_GATE ||
|
||||||
|
event.getClickedBlock().getType() == Material.OAK_FENCE_GATE ||
|
||||||
|
event.getClickedBlock().getType() == Material.SPRUCE_FENCE_GATE ||
|
||||||
|
event.getClickedBlock().getType() == Material.WARPED_FENCE_GATE
|
||||||
|
) {
|
||||||
|
if(status.equals("Playing") || status.equals("Starting") || !event.getPlayer().hasPermission("hideandseek.blockbypass")) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onHangingBreakByEntity(HangingBreakByEntityEvent event) {
|
||||||
|
if(event.getEntity() instanceof ItemFrame) {
|
||||||
|
if(unbreakableItemframes) {
|
||||||
|
if(event.getRemover() instanceof Player) {
|
||||||
|
Player player = (Player) event.getRemover();
|
||||||
|
if(status.equals("Playing") || status.equals("Starting") || !player.hasPermission("hideandseek.blockbypass")) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(event.getEntity() instanceof Painting) {
|
||||||
|
if(unbreakableArmorstands) {
|
||||||
|
if(event.getRemover() instanceof Player) {
|
||||||
|
Player player = (Player) event.getRemover();
|
||||||
|
if(status.equals("Playing") || status.equals("Starting") || !player.hasPermission("hideandseek.blockbypass")) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onProjectile(ProjectileLaunchEvent event) {
|
public void onProjectile(ProjectileLaunchEvent event) {
|
||||||
if(!status.equals("Playing")) return;
|
if(!status.equals("Playing")) return;
|
||||||
|
|
|
@ -9,5 +9,39 @@ commands:
|
||||||
hideandseek:
|
hideandseek:
|
||||||
description: Hide and Seek command
|
description: Hide and Seek command
|
||||||
usage: /hideandseek [about|help|start|stop|setspawn|setseeker]
|
usage: /hideandseek [about|help|start|stop|setspawn|setseeker]
|
||||||
permission: hideAndSeek.admin
|
|
||||||
aliases: hs
|
aliases: hs
|
||||||
|
permissions:
|
||||||
|
hideandseek.*:
|
||||||
|
description: Gives access to all hideandseek commands
|
||||||
|
children:
|
||||||
|
hideandseek.about: true
|
||||||
|
hideandseek.help: true
|
||||||
|
hideandseek.reload: true
|
||||||
|
hideandseek.setborder: true
|
||||||
|
hideandseek.setspawn: true
|
||||||
|
hideandseek.start: true
|
||||||
|
hideandseek.stop: true
|
||||||
|
hideandseek.about:
|
||||||
|
description: Allows you to run the about command
|
||||||
|
default: true
|
||||||
|
hideandseek.help:
|
||||||
|
description: Allows you to run the help command
|
||||||
|
default: true
|
||||||
|
hideandseek.reload:
|
||||||
|
description: Allows you to reload the config
|
||||||
|
default: op
|
||||||
|
hideandseek.setborder:
|
||||||
|
description: Allows you to set the game worldborder
|
||||||
|
default: op
|
||||||
|
hideandseek.setspawn:
|
||||||
|
description: Allows you to set the game spawn point
|
||||||
|
default: op
|
||||||
|
hideandseek.start:
|
||||||
|
description: Allows you to start the game
|
||||||
|
default: op
|
||||||
|
hideandseek.stop:
|
||||||
|
description: Allows you to stop the game
|
||||||
|
default: op
|
||||||
|
hideandseek.blockbypass:
|
||||||
|
description: Allows you to bypass the block break prevention
|
||||||
|
default: op
|
||||||
|
|
Loading…
Reference in a new issue