Improves setup description
This commit is contained in:
parent
638094be33
commit
b6eb6a26d1
92
README.md
92
README.md
@ -50,27 +50,27 @@ _**Note:** Instead of using /BlockHunt you could use:_
|
||||
|
||||
<> = Required [] = Optional
|
||||
|
||||
| Command | Description | Permission | Default allowed |
|
||||
|--------------------------------------------------------------------|---------------------------------------------------|-----------------------------|-------------------------------------------------|
|
||||
| `/BlockHunt [info/i]` | Displays the plugin's info. | blockhunt.info | All players have this permission from default._ |
|
||||
| `/BlockHunt <help/h>` | Shows a list of commands. | blockhunt.help | All players have this permission from default._ |
|
||||
| `/BlockHunt <reload/r>` | Reloads all configs. | blockhunt.reload | blockhunt.admin |
|
||||
| `/BlockHunt <join/j> <arenaName>` | Joins a BlockHunt game. | blockhunt.join | blockhunt.player |
|
||||
| `/BlockHunt <leave/l>` | Leave a BlockHunt game. | blockhunt.leave | blockhunt.player |
|
||||
| `/BlockHunt <list/li>` | Shows a list of available arenas. | blockhunt.list | blockhunt.player |
|
||||
| `/BlockHunt <shop/sh>` | Opens the BlockHunt shop. | blockhunt.shop | blockhunt.player |
|
||||
| `/BlockHunt <start/go> <arenaName>` | Forces an arena to start. | blockhunt.start | blockhunt.moderator |
|
||||
| `/BlockHunt <wand/w>` | Gives you the wand selection tool. | blockhunt.create | blockhunt.admin |
|
||||
| `/BlockHunt <create/c> <arenaName>` | Creates an arena from your selection. | blockhunt.create | blockhunt.admin |
|
||||
| `/BlockHunt <set/s> <arenaName>` | Opens a panel to set settings. | blockhunt.set | blockhunt.moderator |
|
||||
| `/BlockHunt <setWarp/sw> <lobby/hiders/seekers/spawn> <arenaName>` | Sets warps for your arena. | blockhunt.setWarp | blockhunt.moderator |
|
||||
| `/BlockHunt <remove/delete> <arenaName>` | Deletes an Arena. | blockhunt.remove | blockhunt.admin |
|
||||
| `/BlockHunt <tokens/t> <set/add/take> <%playerName%> <amount>` | Change someones tokens. | blockhunt.tokens | blockhunt.admin |
|
||||
| | Able to join full games. | blockhunt.joinfull | blockhunt.moderator |
|
||||
| | Able to join/leave using join/leave signs. | blockhunt.joinsign | blockhunt.player |
|
||||
| | Able to create a join/leave sign. | blockhunt.signcreate | blockhunt.moderator |
|
||||
| | Gives you the BlockChooser. | blockhunt.shop.blockchooser | blockhunt.admin |
|
||||
| | Gives you the ability to do all commands in-game. | blockhunt.allcommands | Operators |
|
||||
| Command | Description | Permission | Default allowed |
|
||||
|--------------------------------------------------------------------|---------------------------------------------------|-----------------------------|----------------------------------------------|
|
||||
| `/BlockHunt [info/i]` | Displays the plugin's info. | blockhunt.info | All players have this permission by default. |
|
||||
| `/BlockHunt <help/h>` | Shows a list of commands. | blockhunt.help | All players have this permission by default. |
|
||||
| `/BlockHunt <reload/r>` | Reloads all configs. | blockhunt.reload | blockhunt.admin |
|
||||
| `/BlockHunt <join/j> <arenaName>` | Joins a BlockHunt game. | blockhunt.join | blockhunt.player |
|
||||
| `/BlockHunt <leave/l>` | Leave a BlockHunt game. | blockhunt.leave | blockhunt.player |
|
||||
| `/BlockHunt <list/li>` | Shows a list of available arenas. | blockhunt.list | blockhunt.player |
|
||||
| `/BlockHunt <shop/sh>` | Opens the BlockHunt shop. | blockhunt.shop | blockhunt.player |
|
||||
| `/BlockHunt <start/go> <arenaName>` | Forces an arena to start. | blockhunt.start | blockhunt.moderator |
|
||||
| `/BlockHunt <wand/w>` | Gives you the wand selection tool. | blockhunt.create | blockhunt.admin |
|
||||
| `/BlockHunt <create/c> <arenaName>` | Creates an arena from your selection. | blockhunt.create | blockhunt.admin |
|
||||
| `/BlockHunt <set/s> <arenaName>` | Opens a panel to set settings. | blockhunt.set | blockhunt.moderator |
|
||||
| `/BlockHunt <setWarp/sw> <lobby/hiders/seekers/spawn> <arenaName>` | Sets warps for your arena. | blockhunt.setWarp | blockhunt.moderator |
|
||||
| `/BlockHunt <remove/delete> <arenaName>` | Deletes an Arena. | blockhunt.remove | blockhunt.admin |
|
||||
| `/BlockHunt <tokens/t> <set/add/take> <%playerName%> <amount>` | Change someones tokens. | blockhunt.tokens | blockhunt.admin |
|
||||
| | Able to join full games. | blockhunt.joinfull | blockhunt.moderator |
|
||||
| | Able to join/leave using join/leave signs. | blockhunt.joinsign | blockhunt.player |
|
||||
| | Able to create a join/leave sign. | blockhunt.signcreate | blockhunt.moderator |
|
||||
| | Gives you the BlockChooser. | blockhunt.shop.blockchooser | blockhunt.admin |
|
||||
| | Gives you the ability to do all commands in-game. | blockhunt.allcommands | Operators |
|
||||
|
||||
### Other special permissions
|
||||
|
||||
@ -100,11 +100,33 @@ and then left-click with the wand on the opposite corner. Make sure one corner i
|
||||
that the other is above the top of the arena.
|
||||
|
||||
Use `/bh create \<name>` to create your new arena with name \<name>. Use `/bh set \<name>` to get a GUI for setting the
|
||||
properties of the arena. You can set the maximum number of players that can play at once, the minimum amount of players
|
||||
for a game to start, the amount of seekers required to start, the amount of seconds to keep the players in the lobby (
|
||||
allowing other players to join) before starting the arena, the number of seconds to wait until seekers can start
|
||||
seeking, the amount of time a game will last, the amount of seconds between each time the number of remaining hiders is
|
||||
announced, the number of seconds before the game ends the hiders will be given swords.
|
||||
properties of the arena. See [this](#arena-interface-descriptions) for information about the various settable values.
|
||||
When you've set the values as wanted, click the book. In the inventory, put all blocks you want hiders to use.
|
||||
|
||||
The last step in the setup is to set the warps. Use `/bh sw lobby \<name>` to set the lobby at your current location.
|
||||
The lobby is the location players are teleported to after joining, before the arena starts. Use `/bh sw hiders \<name>`
|
||||
to set the hiders spawn. This is where hiders are teleported once the arena starts. Use `/bh sw seekers \<name>`
|
||||
to set the seekers location at your current location. The seekers location is where seekers are teleported when the
|
||||
arena starts. Choose a place where they cannot reach or see the hiders, as they are teleported to the hiders warp once
|
||||
they are allowed to start seeking. Use `/bh sw spawn \<name>` to set the locations players will go to when exiting the
|
||||
arena.
|
||||
|
||||
You can set up a join sign, which also displays current players, by creating a sign like:
|
||||
|
||||
1. \[BlockHunt]
|
||||
2. \<name>
|
||||
|
||||
You can set up a leave sign, by creating a sign, in the arena and/or lobby, like:
|
||||
|
||||
1. \[BlockHunt]
|
||||
2. Leave
|
||||
|
||||
You can set up a shop sign, by creating a sign like:
|
||||
|
||||
1. \[BlockHunt]
|
||||
2. Shop
|
||||
|
||||
Join your new arena with `/bh join \<name>`.
|
||||
|
||||
### Arena interface descriptions
|
||||
|
||||
@ -136,8 +158,20 @@ The amount of seconds a game will last. If the hiders are alive after this time,
|
||||
|
||||
#### blockAnnouncerTime
|
||||
|
||||
The amount of seconds
|
||||
The amount of seconds left when announcing the number of currently hiding players.
|
||||
|
||||
#### sword
|
||||
#### timeUntilHidersSword
|
||||
|
||||
The amount of seconds to wait before allowing hiders to defend themselves with a wooden sword.
|
||||
The amount of seconds to wait before allowing hiders to defend themselves with a wooden sword.
|
||||
|
||||
#### hidersTokenWin
|
||||
|
||||
The number of tokens rewarded if the hiders win.
|
||||
|
||||
#### seekersTokenWin
|
||||
|
||||
The number of tokens rewarded if the seekers win.
|
||||
|
||||
#### killTokens
|
||||
|
||||
The number of tokens rewarded if a seeker kills a hider.
|
@ -19,8 +19,8 @@ import java.util.Map;
|
||||
public class Arena implements ConfigurationSerializable {
|
||||
|
||||
public final String arenaName;
|
||||
public final Location pos1;
|
||||
public final Location pos2;
|
||||
public final Location corner1;
|
||||
public final Location corner2;
|
||||
public int maxPlayers;
|
||||
public int minPlayers;
|
||||
public int amountSeekersOnStart;
|
||||
@ -52,7 +52,7 @@ public class Arena implements ConfigurationSerializable {
|
||||
public final List<Player> seekers;
|
||||
public final Scoreboard scoreboard;
|
||||
|
||||
public Arena(String arenaName, Location pos1, Location pos2, int maxPlayers, int minPlayers, int amountSeekersOnStart,
|
||||
public Arena(String arenaName, Location corner1, Location corner2, int maxPlayers, int minPlayers, int amountSeekersOnStart,
|
||||
int timeInLobbyUntilStart, int waitingTimeSeeker, int gameTime, int timeUntilHidersSword,
|
||||
int blockAnnouncerTime, boolean seekersCanHurtSeekers, boolean hidersCanHurtSeekers,
|
||||
boolean hidersCanHurtHiders, boolean seekersTakeFallDamage, boolean hidersTakeFallDamage,
|
||||
@ -62,8 +62,8 @@ public class Arena implements ConfigurationSerializable {
|
||||
List<Player> playersInArena, ArenaState gameState, int timer, List<Player> seekers,
|
||||
Scoreboard scoreboard) {
|
||||
this.arenaName = arenaName;
|
||||
this.pos1 = pos1;
|
||||
this.pos2 = pos2;
|
||||
this.corner1 = corner1;
|
||||
this.corner2 = corner2;
|
||||
this.maxPlayers = maxPlayers;
|
||||
this.minPlayers = minPlayers;
|
||||
this.amountSeekersOnStart = amountSeekersOnStart;
|
||||
@ -99,8 +99,8 @@ public class Arena implements ConfigurationSerializable {
|
||||
public @NotNull Map<String, Object> serialize() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("arenaName", arenaName);
|
||||
map.put("pos1", pos1);
|
||||
map.put("pos2", pos2);
|
||||
map.put("pos1", corner1);
|
||||
map.put("pos2", corner2);
|
||||
map.put("maxPlayers", maxPlayers);
|
||||
map.put("minPlayers", minPlayers);
|
||||
map.put("amountSeekersOnStart", amountSeekersOnStart);
|
||||
|
@ -73,164 +73,165 @@ public class ArenaHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (!alreadyJoined) {
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.arenaName.equalsIgnoreCase(arenaName)) {
|
||||
found = true;
|
||||
if (arena.disguiseBlocks.isEmpty()) {
|
||||
MessageManager.sendFMessage(player, MessageKey.ERROR_JOIN_NO_BLOCKS_SET);
|
||||
} else {
|
||||
boolean inventoryEmpty = true;
|
||||
for (ItemStack inventoryItem : player.getInventory()) {
|
||||
if (inventoryItem != null) {
|
||||
if (inventoryItem.getType() != Material.AIR) {
|
||||
inventoryEmpty = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (alreadyJoined) {
|
||||
MessageManager.sendFMessage(player, MessageKey.ERROR_JOIN_ALREADY_JOINED);
|
||||
return;
|
||||
}
|
||||
|
||||
for (ItemStack inventoryItem : player.getInventory().getArmorContents()) {
|
||||
if (inventoryItem != null) {
|
||||
if (inventoryItem.getType() != Material.AIR) {
|
||||
inventoryEmpty = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((Boolean) MemoryStorage.config.get(ConfigKey.REQUIRE_INVENTORY_CLEAR_ON_JOIN) && !inventoryEmpty) {
|
||||
MessageManager.sendFMessage(player, MessageKey.ERROR_JOIN_INVENTORY_NOT_EMPTY);
|
||||
return;
|
||||
}
|
||||
|
||||
Location zero = new Location(Bukkit.getWorld(player.getWorld().getName()), 0, 0, 0, 0, 0);
|
||||
if (arena.lobbyWarp != null && arena.hidersWarp != null && arena.seekersWarp != null && arena.spawnWarp != null) {
|
||||
if (!arena.lobbyWarp.equals(zero) && !arena.hidersWarp.equals(zero) && !arena.seekersWarp.equals(zero) && !arena.spawnWarp.equals(zero)) {
|
||||
if (arena.gameState == ArenaState.WAITING || arena.gameState == ArenaState.STARTING) {
|
||||
if (arena.playersInArena.size() >= arena.maxPlayers) {
|
||||
if (!PermissionsManager.hasPermission(player, Permission.JOIN_FULL, false)) {
|
||||
MessageManager.sendFMessage(player, MessageKey.ERROR_JOIN_FULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
boolean canWarp = PlayerHandler.teleport(player, arena.lobbyWarp);
|
||||
if (!canWarp) {
|
||||
MessageManager.sendFMessage(player, MessageKey.ERROR_TELEPORT_FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
BlockHunt.plugin.getLogger().log(Level.INFO, player.getName() + " has joined " + arenaName);
|
||||
arena.playersInArena.add(player);
|
||||
JoinArenaEvent event = new JoinArenaEvent(player, arena);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
PlayerArenaData pad = new PlayerArenaData(player.getLocation(), player.getGameMode(), player.getInventory().getContents(), player
|
||||
.getInventory().getArmorContents(), player.getExp(), player.getLevel(), player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(), player.getHealth(), player.getFoodLevel(),
|
||||
player.getActivePotionEffects(), player.getAllowFlight());
|
||||
|
||||
MemoryStorage.pData.put(player, pad);
|
||||
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
for (PotionEffect pe : player.getActivePotionEffects()) {
|
||||
player.removePotionEffect(pe.getType());
|
||||
}
|
||||
player.setFoodLevel(20);
|
||||
player.setHealth(20);
|
||||
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(20);
|
||||
player.setLevel(arena.timer);
|
||||
player.setExp(0);
|
||||
player.getInventory().clear();
|
||||
player.getInventory().setHelmet(new ItemStack(Material.AIR));
|
||||
player.getInventory().setChestplate(new ItemStack(Material.AIR));
|
||||
player.getInventory().setLeggings(new ItemStack(Material.AIR));
|
||||
player.getInventory().setBoots(new ItemStack(Material.AIR));
|
||||
player.setFlying(false);
|
||||
player.setAllowFlight(false);
|
||||
player.setWalkSpeed(0.2F);
|
||||
|
||||
// Fix for client not showing players after
|
||||
// they join
|
||||
for (Player otherPlayer : arena.playersInArena) {
|
||||
if (otherPlayer.canSee(player)) {
|
||||
otherPlayer.showPlayer(BlockHunt.plugin, player); // Make
|
||||
}
|
||||
// new
|
||||
// player
|
||||
// visible
|
||||
// to
|
||||
// others
|
||||
if (player.canSee(otherPlayer)) {
|
||||
player.showPlayer(BlockHunt.plugin, otherPlayer); // Make
|
||||
}
|
||||
// other
|
||||
// players
|
||||
// visible
|
||||
// to
|
||||
// new
|
||||
// player
|
||||
}
|
||||
|
||||
if ((Boolean) MemoryStorage.config.get(ConfigKey.SHOP_BLOCK_CHOOSER_V_1_ENABLED)) {
|
||||
if (MemoryStorage.shop.getFile().get(player.getName() + ".blockchooser") != null
|
||||
|| PermissionsManager.hasPermission(player, Permission.SHOP_BLOCK_CHOOSER, false)) {
|
||||
ItemStack shopBlockChooser = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigKey.SHOP_BLOCK_CHOOSER_V_1_ID_NAME)), 1);
|
||||
ItemMeta shopBlockChooser_IM = shopBlockChooser.getItemMeta();
|
||||
shopBlockChooser_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigKey.SHOP_BLOCK_CHOOSER_V_1_NAME)));
|
||||
List<String> loreStrings = MemoryStorage.config.getFile().getStringList(ConfigKey.SHOP_BLOCK_CHOOSER_V_1_DESCRIPTION.getPath());
|
||||
List<String> loreStrings2 = new ArrayList<>();
|
||||
for (String lore : loreStrings) {
|
||||
loreStrings2.add(MessageManager.replaceAll(lore));
|
||||
}
|
||||
shopBlockChooser_IM.setLore(loreStrings2);
|
||||
shopBlockChooser.setItemMeta(shopBlockChooser_IM);
|
||||
|
||||
player.getInventory().addItem(shopBlockChooser);
|
||||
}
|
||||
}
|
||||
|
||||
if ((Boolean) MemoryStorage.config.get(ConfigKey.SHOP_BLOCK_HUNT_PASS_V_2_ENABLED)) {
|
||||
if (MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") != 0) {
|
||||
ItemStack shopBlockHuntPass = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigKey.SHOP_BLOCK_HUNT_PASS_V_2_ID_NAME)),
|
||||
1);
|
||||
ItemMeta shopBlockHuntPass_IM = shopBlockHuntPass.getItemMeta();
|
||||
shopBlockHuntPass_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigKey.SHOP_BLOCK_HUNT_PASS_V_2_NAME)));
|
||||
List<String> loreStrings = MemoryStorage.config.getFile().getStringList(ConfigKey.SHOP_BLOCK_HUNT_PASS_V_2_DESCRIPTION.getPath());
|
||||
List<String> loreStrings2 = new ArrayList<>();
|
||||
for (String lore : loreStrings) {
|
||||
loreStrings2.add(MessageManager.replaceAll(lore));
|
||||
}
|
||||
|
||||
shopBlockHuntPass_IM.setLore(loreStrings2);
|
||||
shopBlockHuntPass.setItemMeta(shopBlockHuntPass_IM);
|
||||
shopBlockHuntPass.setAmount(MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass"));
|
||||
|
||||
player.getInventory().addItem(shopBlockHuntPass);
|
||||
}
|
||||
}
|
||||
player.updateInventory();
|
||||
|
||||
DisguiseAPI.undisguiseToAll(player);
|
||||
|
||||
ArenaHandler.sendFMessage(arena, MessageKey.NORMAL_JOIN_JOINED_ARENA, "%playerName%-" + player.getName(),
|
||||
"1-" + arena.playersInArena.size(), "2-" + arena.maxPlayers);
|
||||
if (arena.playersInArena.size() < arena.minPlayers) {
|
||||
sendFMessage(arena, MessageKey.WARNING_LOBBY_NEED_AT_LEAST, "1-" + arena.minPlayers);
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, MessageKey.ERROR_JOIN_ARENA_IN_GAME);
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, MessageKey.ERROR_JOIN_WARPS_NOT_SET);
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, MessageKey.ERROR_JOIN_WARPS_NOT_SET);
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (!arena.arenaName.equalsIgnoreCase(arenaName)) {
|
||||
continue;
|
||||
}
|
||||
found = true;
|
||||
if (arena.disguiseBlocks.isEmpty()) {
|
||||
MessageManager.sendFMessage(player, MessageKey.ERROR_JOIN_NO_BLOCKS_SET);
|
||||
} else {
|
||||
boolean inventoryEmpty = true;
|
||||
for (ItemStack inventoryItem : player.getInventory()) {
|
||||
if (inventoryItem != null) {
|
||||
if (inventoryItem.getType() != Material.AIR) {
|
||||
inventoryEmpty = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (ItemStack inventoryItem : player.getInventory().getArmorContents()) {
|
||||
if (inventoryItem != null) {
|
||||
if (inventoryItem.getType() != Material.AIR) {
|
||||
inventoryEmpty = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((Boolean) MemoryStorage.config.get(ConfigKey.REQUIRE_INVENTORY_CLEAR_ON_JOIN) && !inventoryEmpty) {
|
||||
MessageManager.sendFMessage(player, MessageKey.ERROR_JOIN_INVENTORY_NOT_EMPTY);
|
||||
return;
|
||||
}
|
||||
|
||||
Location zero = new Location(Bukkit.getWorld(player.getWorld().getName()), 0, 0, 0, 0, 0);
|
||||
if (arena.lobbyWarp != null && arena.hidersWarp != null && arena.seekersWarp != null && arena.spawnWarp != null) {
|
||||
if (!arena.lobbyWarp.equals(zero) && !arena.hidersWarp.equals(zero) &&
|
||||
!arena.seekersWarp.equals(zero) && !arena.spawnWarp.equals(zero)) {
|
||||
if (arena.gameState == ArenaState.WAITING || arena.gameState == ArenaState.STARTING) {
|
||||
if (arena.playersInArena.size() >= arena.maxPlayers &&
|
||||
!PermissionsManager.hasPermission(player, Permission.JOIN_FULL, false)) {
|
||||
MessageManager.sendFMessage(player, MessageKey.ERROR_JOIN_FULL);
|
||||
return;
|
||||
}
|
||||
|
||||
boolean canWarp = PlayerHandler.teleport(player, arena.lobbyWarp);
|
||||
if (!canWarp) {
|
||||
MessageManager.sendFMessage(player, MessageKey.ERROR_TELEPORT_FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
BlockHunt.plugin.getLogger().log(Level.INFO, player.getName() + " has joined " + arenaName);
|
||||
arena.playersInArena.add(player);
|
||||
JoinArenaEvent event = new JoinArenaEvent(player, arena);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
PlayerArenaData pad = new PlayerArenaData(player.getLocation(), player.getGameMode(), player.getInventory().getContents(), player
|
||||
.getInventory().getArmorContents(), player.getExp(), player.getLevel(), player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(), player.getHealth(), player.getFoodLevel(),
|
||||
player.getActivePotionEffects(), player.getAllowFlight());
|
||||
|
||||
MemoryStorage.pData.put(player, pad);
|
||||
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
for (PotionEffect pe : player.getActivePotionEffects()) {
|
||||
player.removePotionEffect(pe.getType());
|
||||
}
|
||||
player.setFoodLevel(20);
|
||||
player.setHealth(20);
|
||||
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(20);
|
||||
player.setLevel(arena.timer);
|
||||
player.setExp(0);
|
||||
player.getInventory().clear();
|
||||
player.getInventory().setHelmet(new ItemStack(Material.AIR));
|
||||
player.getInventory().setChestplate(new ItemStack(Material.AIR));
|
||||
player.getInventory().setLeggings(new ItemStack(Material.AIR));
|
||||
player.getInventory().setBoots(new ItemStack(Material.AIR));
|
||||
player.setFlying(false);
|
||||
player.setAllowFlight(false);
|
||||
player.setWalkSpeed(0.2F);
|
||||
|
||||
// Fix for client not showing players after
|
||||
// they join
|
||||
for (Player otherPlayer : arena.playersInArena) {
|
||||
if (otherPlayer.canSee(player)) {
|
||||
otherPlayer.showPlayer(BlockHunt.plugin, player); // Make
|
||||
}
|
||||
// new
|
||||
// player
|
||||
// visible
|
||||
// to
|
||||
// others
|
||||
if (player.canSee(otherPlayer)) {
|
||||
player.showPlayer(BlockHunt.plugin, otherPlayer); // Make
|
||||
}
|
||||
// other
|
||||
// players
|
||||
// visible
|
||||
// to
|
||||
// new
|
||||
// player
|
||||
}
|
||||
|
||||
if ((Boolean) MemoryStorage.config.get(ConfigKey.SHOP_BLOCK_CHOOSER_V_1_ENABLED)) {
|
||||
if (MemoryStorage.shop.getFile().get(player.getName() + ".blockchooser") != null
|
||||
|| PermissionsManager.hasPermission(player, Permission.SHOP_BLOCK_CHOOSER, false)) {
|
||||
ItemStack shopBlockChooser = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigKey.SHOP_BLOCK_CHOOSER_V_1_ID_NAME)), 1);
|
||||
ItemMeta shopBlockChooser_IM = shopBlockChooser.getItemMeta();
|
||||
shopBlockChooser_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigKey.SHOP_BLOCK_CHOOSER_V_1_NAME)));
|
||||
List<String> loreStrings = MemoryStorage.config.getFile().getStringList(ConfigKey.SHOP_BLOCK_CHOOSER_V_1_DESCRIPTION.getPath());
|
||||
List<String> loreStrings2 = new ArrayList<>();
|
||||
for (String lore : loreStrings) {
|
||||
loreStrings2.add(MessageManager.replaceAll(lore));
|
||||
}
|
||||
shopBlockChooser_IM.setLore(loreStrings2);
|
||||
shopBlockChooser.setItemMeta(shopBlockChooser_IM);
|
||||
|
||||
player.getInventory().addItem(shopBlockChooser);
|
||||
}
|
||||
}
|
||||
|
||||
if ((Boolean) MemoryStorage.config.get(ConfigKey.SHOP_BLOCK_HUNT_PASS_V_2_ENABLED)) {
|
||||
if (MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") != 0) {
|
||||
ItemStack shopBlockHuntPass = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigKey.SHOP_BLOCK_HUNT_PASS_V_2_ID_NAME)),
|
||||
1);
|
||||
ItemMeta shopBlockHuntPass_IM = shopBlockHuntPass.getItemMeta();
|
||||
shopBlockHuntPass_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigKey.SHOP_BLOCK_HUNT_PASS_V_2_NAME)));
|
||||
List<String> loreStrings = MemoryStorage.config.getFile().getStringList(ConfigKey.SHOP_BLOCK_HUNT_PASS_V_2_DESCRIPTION.getPath());
|
||||
List<String> loreStrings2 = new ArrayList<>();
|
||||
for (String lore : loreStrings) {
|
||||
loreStrings2.add(MessageManager.replaceAll(lore));
|
||||
}
|
||||
|
||||
shopBlockHuntPass_IM.setLore(loreStrings2);
|
||||
shopBlockHuntPass.setItemMeta(shopBlockHuntPass_IM);
|
||||
shopBlockHuntPass.setAmount(MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass"));
|
||||
|
||||
player.getInventory().addItem(shopBlockHuntPass);
|
||||
}
|
||||
}
|
||||
player.updateInventory();
|
||||
|
||||
DisguiseAPI.undisguiseToAll(player);
|
||||
|
||||
ArenaHandler.sendFMessage(arena, MessageKey.NORMAL_JOIN_JOINED_ARENA, "%playerName%-" + player.getName(),
|
||||
"1-" + arena.playersInArena.size(), "2-" + arena.maxPlayers);
|
||||
if (arena.playersInArena.size() < arena.minPlayers) {
|
||||
sendFMessage(arena, MessageKey.WARNING_LOBBY_NEED_AT_LEAST, "1-" + arena.minPlayers);
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, MessageKey.ERROR_JOIN_ARENA_IN_GAME);
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, MessageKey.ERROR_JOIN_WARPS_NOT_SET);
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, MessageKey.ERROR_JOIN_WARPS_NOT_SET);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, MessageKey.ERROR_JOIN_ALREADY_JOINED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
@ -258,9 +259,7 @@ public class ArenaHandler {
|
||||
|
||||
if (cleanup) {
|
||||
arena.playersInArena.remove(player);
|
||||
if (arena.seekers.contains(player)) {
|
||||
arena.seekers.remove(player);
|
||||
}
|
||||
arena.seekers.remove(player);
|
||||
|
||||
if (arena.playersInArena.size() < arena.minPlayers && arena.gameState.equals(ArenaState.STARTING)) {
|
||||
arena.gameState = ArenaState.WAITING;
|
||||
|
@ -13,15 +13,11 @@ public class BlockHuntTabCompleter implements TabCompleter {
|
||||
@Override
|
||||
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull org.bukkit.command.Command cmd, @NotNull String label,
|
||||
String[] args) {
|
||||
|
||||
for (Command command : MemoryStorage.commands) {
|
||||
if (cmd.getName().equalsIgnoreCase(command.label())) {
|
||||
if (args.length == 1) {
|
||||
return command.mainTabList();
|
||||
}
|
||||
if (cmd.getName().equalsIgnoreCase(command.label()) && args.length == 1) {
|
||||
return command.mainTabList();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,6 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class HelpCommand extends DefaultCommand {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, String[] args) {
|
||||
int amountCommands = 0;
|
||||
|
@ -28,11 +28,11 @@ public class OnPlayerMoveEvent implements Listener {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
if (arena.gameState == ArenaState.IN_GAME) {
|
||||
MemoryStorage.moveLoc.put(player, player.getLocation());
|
||||
if (arena.pos1 == null || arena.pos2 == null) {
|
||||
if (arena.corner1 == null || arena.corner2 == null) {
|
||||
BlockHunt.plugin.getLogger().info("Arena:" +
|
||||
arena.arenaName + " appears to have bad coords : pos1:" +
|
||||
((arena.pos1 != null) ? arena.pos1.toString() : " NULL") + " Pos2:" +
|
||||
((arena.pos2 != null) ? arena.pos2.toString() : " NULL"));
|
||||
((arena.corner1 != null) ? arena.corner1.toString() : " NULL") + " Pos2:" +
|
||||
((arena.corner2 != null) ? arena.corner2.toString() : " NULL"));
|
||||
BlockHunt.plugin.getLogger().info("Player has been returned to hiderswarp due to bad arena state");
|
||||
//event.setCancelled(true);
|
||||
Location loc = player.getLocation();
|
||||
@ -41,12 +41,12 @@ public class OnPlayerMoveEvent implements Listener {
|
||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||
return;
|
||||
}
|
||||
double maxX = Math.max(arena.pos1.getX(), arena.pos2.getX());
|
||||
double minX = Math.min(arena.pos1.getX(), arena.pos2.getX());
|
||||
double maxY = Math.max(arena.pos1.getY(), arena.pos2.getY());
|
||||
double minY = Math.min(arena.pos1.getY(), arena.pos2.getY());
|
||||
double maxZ = Math.max(arena.pos1.getZ(), arena.pos2.getZ());
|
||||
double minZ = Math.min(arena.pos1.getZ(), arena.pos2.getZ());
|
||||
double maxX = Math.max(arena.corner1.getX(), arena.corner2.getX());
|
||||
double minX = Math.min(arena.corner1.getX(), arena.corner2.getX());
|
||||
double maxY = Math.max(arena.corner1.getY(), arena.corner2.getY());
|
||||
double minY = Math.min(arena.corner1.getY(), arena.corner2.getY());
|
||||
double maxZ = Math.max(arena.corner1.getZ(), arena.corner2.getZ());
|
||||
double minZ = Math.min(arena.corner1.getZ(), arena.corner2.getZ());
|
||||
|
||||
Location loc = player.getLocation();
|
||||
if (loc.getBlockX() > maxX) {
|
||||
|
Loading…
Reference in New Issue
Block a user