* Better solid blocks! (It does like the hives right now! ;3)
This commit is contained in:
parent
ccccacb760
commit
adf2c14eb1
@ -13,6 +13,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -88,7 +89,7 @@ public class ArenaHandler {
|
|||||||
player.getLocation());
|
player.getLocation());
|
||||||
W.pGameMode.put(player,
|
W.pGameMode.put(player,
|
||||||
player.getGameMode());
|
player.getGameMode());
|
||||||
player.setGameMode(GameMode.ADVENTURE);
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
W.pInventory.put(player, player
|
W.pInventory.put(player, player
|
||||||
.getInventory().getContents());
|
.getInventory().getContents());
|
||||||
player.getInventory().clear();
|
player.getInventory().clear();
|
||||||
@ -220,8 +221,17 @@ public class ArenaHandler {
|
|||||||
player.setFoodLevel(W.pFood.get(player));
|
player.setFoodLevel(W.pFood.get(player));
|
||||||
W.pFood.remove(player);
|
W.pFood.remove(player);
|
||||||
|
|
||||||
if (W.dcAPI.isDisguised(player)) {
|
for (Player pl : Bukkit.getOnlinePlayers()) {
|
||||||
W.dcAPI.undisguisePlayer(player);
|
pl.showPlayer(player);
|
||||||
|
if (W.hiddenLoc.get(player) != null) {
|
||||||
|
Block pBlock = W.hiddenLoc.get(player).getBlock();
|
||||||
|
pl.sendBlockChange(pBlock.getLocation(), Material.AIR,
|
||||||
|
(byte) 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (W.dcAPI.isDisguised(player)) {
|
||||||
|
W.dcAPI.undisguisePlayer(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScoreboardHandler.removeScoreboard(player);
|
ScoreboardHandler.removeScoreboard(player);
|
||||||
|
@ -9,10 +9,10 @@ import nl.Steffion.BlockHunt.Listeners.OnBlockPlaceEvent;
|
|||||||
import nl.Steffion.BlockHunt.Listeners.OnEntityDamageByEntityEvent;
|
import nl.Steffion.BlockHunt.Listeners.OnEntityDamageByEntityEvent;
|
||||||
import nl.Steffion.BlockHunt.Listeners.OnEntityDamageEvent;
|
import nl.Steffion.BlockHunt.Listeners.OnEntityDamageEvent;
|
||||||
import nl.Steffion.BlockHunt.Listeners.OnFoodLevelChangeEvent;
|
import nl.Steffion.BlockHunt.Listeners.OnFoodLevelChangeEvent;
|
||||||
import nl.Steffion.BlockHunt.Listeners.OnPlayerCommandPreprocessEvent;
|
|
||||||
import nl.Steffion.BlockHunt.Listeners.OnPlayerDeathEvent;
|
|
||||||
import nl.Steffion.BlockHunt.Listeners.OnInventoryClickEvent;
|
import nl.Steffion.BlockHunt.Listeners.OnInventoryClickEvent;
|
||||||
import nl.Steffion.BlockHunt.Listeners.OnInventoryCloseEvent;
|
import nl.Steffion.BlockHunt.Listeners.OnInventoryCloseEvent;
|
||||||
|
import nl.Steffion.BlockHunt.Listeners.OnPlayerCommandPreprocessEvent;
|
||||||
|
import nl.Steffion.BlockHunt.Listeners.OnPlayerDeathEvent;
|
||||||
import nl.Steffion.BlockHunt.Listeners.OnPlayerDropItemEvent;
|
import nl.Steffion.BlockHunt.Listeners.OnPlayerDropItemEvent;
|
||||||
import nl.Steffion.BlockHunt.Listeners.OnPlayerInteractEvent;
|
import nl.Steffion.BlockHunt.Listeners.OnPlayerInteractEvent;
|
||||||
import nl.Steffion.BlockHunt.Listeners.OnPlayerMoveEvent;
|
import nl.Steffion.BlockHunt.Listeners.OnPlayerMoveEvent;
|
||||||
@ -22,13 +22,13 @@ import nl.Steffion.BlockHunt.Listeners.OnSignChangeEvent;
|
|||||||
import nl.Steffion.BlockHunt.Managers.CommandC;
|
import nl.Steffion.BlockHunt.Managers.CommandC;
|
||||||
import nl.Steffion.BlockHunt.Managers.ConfigC;
|
import nl.Steffion.BlockHunt.Managers.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageM;
|
import nl.Steffion.BlockHunt.Managers.MessageM;
|
||||||
import nl.Steffion.BlockHunt.Serializables.ArenaSerializable;
|
|
||||||
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
|
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.serialization.ConfigurationSerialization;
|
import org.bukkit.configuration.serialization.ConfigurationSerialization;
|
||||||
@ -85,8 +85,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
ConfigurationSerialization.registerClass(LocationSerializable.class,
|
ConfigurationSerialization.registerClass(LocationSerializable.class,
|
||||||
"Location");
|
"Location");
|
||||||
ConfigurationSerialization.registerClass(ArenaSerializable.class,
|
ConfigurationSerialization.registerClass(Arena.class, "Arena");
|
||||||
"Arena");
|
|
||||||
|
|
||||||
W.newFiles();
|
W.newFiles();
|
||||||
|
|
||||||
@ -229,19 +228,37 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
|||||||
arenaPlayer.getInventory().setHelmet(
|
arenaPlayer.getInventory().setHelmet(
|
||||||
new ItemStack(block));
|
new ItemStack(block));
|
||||||
|
|
||||||
MessageM.sendFMessage(
|
if (block.getDurability() != 0) {
|
||||||
arenaPlayer,
|
MessageM.sendFMessage(
|
||||||
ConfigC.normal_ingameBlock,
|
arenaPlayer,
|
||||||
true,
|
ConfigC.normal_ingameBlock,
|
||||||
"block-"
|
true,
|
||||||
+ block.getType()
|
"block-"
|
||||||
.name()
|
+ block.getType()
|
||||||
.replaceAll("_", "")
|
.name()
|
||||||
.replaceAll(
|
.replaceAll(
|
||||||
"BLOCK", "")
|
"_", "")
|
||||||
.toLowerCase()
|
.replaceAll(
|
||||||
+ ":"
|
"BLOCK",
|
||||||
+ block.getDurability());
|
"")
|
||||||
|
.toLowerCase()
|
||||||
|
+ ":"
|
||||||
|
+ block.getDurability());
|
||||||
|
} else {
|
||||||
|
MessageM.sendFMessage(
|
||||||
|
arenaPlayer,
|
||||||
|
ConfigC.normal_ingameBlock,
|
||||||
|
true,
|
||||||
|
"block-"
|
||||||
|
+ block.getType()
|
||||||
|
.name()
|
||||||
|
.replaceAll(
|
||||||
|
"_", "")
|
||||||
|
.replaceAll(
|
||||||
|
"BLOCK",
|
||||||
|
"")
|
||||||
|
.toLowerCase());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -333,38 +350,122 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
|||||||
if (block.getAmount() > 1) {
|
if (block.getAmount() > 1) {
|
||||||
block.setAmount(block.getAmount() - 1);
|
block.setAmount(block.getAmount() - 1);
|
||||||
} else {
|
} else {
|
||||||
Disguise dis = W.dcAPI
|
Block pBlock = player.getLocation()
|
||||||
.getDisguise(player);
|
.getBlock();
|
||||||
if (!dis.data.isEmpty()) {
|
if (pBlock.getType().equals(
|
||||||
if (!dis.data
|
Material.AIR)) {
|
||||||
.contains("blocklock")) {
|
if (W.dcAPI.isDisguised(player)) {
|
||||||
dis.addSingleData("blocklock");
|
W.dcAPI.undisguisePlayer(player);
|
||||||
W.dcAPI.disguisePlayer(
|
for (Player pl : Bukkit
|
||||||
player, dis);
|
.getOnlinePlayers()) {
|
||||||
|
if (!pl.equals(player)) {
|
||||||
|
// pl.hidePlayer(player);
|
||||||
|
// W.dcAPI.undisguisePlayer(player);
|
||||||
|
pl.hidePlayer(player);
|
||||||
|
pl.sendBlockChange(
|
||||||
|
pBlock.getLocation(),
|
||||||
|
block.getType(),
|
||||||
|
(byte) block
|
||||||
|
.getDurability());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
block.addUnsafeEnchantment(
|
block.addUnsafeEnchantment(
|
||||||
Enchantment.DURABILITY,
|
Enchantment.DURABILITY,
|
||||||
10);
|
10);
|
||||||
player.playSound(pLoc,
|
player.playSound(pLoc,
|
||||||
Sound.ORB_PICKUP,
|
Sound.ORB_PICKUP,
|
||||||
1, 1);
|
1, 1);
|
||||||
|
W.hiddenLoc.put(player,
|
||||||
|
moveLoc);
|
||||||
|
if (block.getDurability() != 0) {
|
||||||
|
MessageM.sendFMessage(
|
||||||
|
player,
|
||||||
|
ConfigC.normal_ingameNowSolid,
|
||||||
|
true,
|
||||||
|
"block-"
|
||||||
|
+ block.getType()
|
||||||
|
.name()
|
||||||
|
.replaceAll(
|
||||||
|
"_",
|
||||||
|
"")
|
||||||
|
.replaceAll(
|
||||||
|
"BLOCK",
|
||||||
|
"")
|
||||||
|
.toLowerCase()
|
||||||
|
+ ":"
|
||||||
|
+ block.getDurability());
|
||||||
|
} else {
|
||||||
|
MessageM.sendFMessage(
|
||||||
|
player,
|
||||||
|
ConfigC.normal_ingameNowSolid,
|
||||||
|
true,
|
||||||
|
"block-"
|
||||||
|
+ block.getType()
|
||||||
|
.name()
|
||||||
|
.replaceAll(
|
||||||
|
"_",
|
||||||
|
"")
|
||||||
|
.replaceAll(
|
||||||
|
"BLOCK",
|
||||||
|
"")
|
||||||
|
.toLowerCase());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
}
|
MessageM.sendFMessage(
|
||||||
} else {
|
player,
|
||||||
Disguise dis = W.dcAPI
|
ConfigC.warning_ingameNoSolidPlace,
|
||||||
.getDisguise(player);
|
true);
|
||||||
block.setAmount(5);
|
|
||||||
if (!dis.data.isEmpty()) {
|
|
||||||
if (dis.data.contains("blocklock")) {
|
|
||||||
dis.data.remove("blocklock");
|
|
||||||
W.dcAPI.disguisePlayer(player,
|
|
||||||
dis);
|
|
||||||
player.playSound(pLoc,
|
|
||||||
Sound.BAT_HURT, 1, 1);
|
|
||||||
block.removeEnchantment(Enchantment.DURABILITY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Block pBlock = player.getLocation()
|
||||||
|
.getBlock();
|
||||||
|
block.setAmount(5);
|
||||||
|
|
||||||
|
if (W.hiddenLoc.get(player) != null) {
|
||||||
|
pBlock = W.hiddenLoc.get(player)
|
||||||
|
.getBlock();
|
||||||
|
}
|
||||||
|
if (!W.dcAPI.isDisguised(player)) {
|
||||||
|
for (Player pl : Bukkit
|
||||||
|
.getOnlinePlayers()) {
|
||||||
|
if (!pl.equals(player)) {
|
||||||
|
pl.sendBlockChange(pBlock
|
||||||
|
.getLocation(),
|
||||||
|
Material.AIR,
|
||||||
|
(byte) 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
player.playSound(pLoc,
|
||||||
|
Sound.BAT_HURT, 1, 1);
|
||||||
|
block.removeEnchantment(Enchantment.DURABILITY);
|
||||||
|
|
||||||
|
LinkedList<String> data = new LinkedList<String>();
|
||||||
|
data.add("blockID:"
|
||||||
|
+ block.getTypeId());
|
||||||
|
data.add("blockData:"
|
||||||
|
+ block.getDurability());
|
||||||
|
Disguise disguise = new Disguise(
|
||||||
|
W.dcAPI.newEntityID(),
|
||||||
|
data,
|
||||||
|
DisguiseType.FallingBlock);
|
||||||
|
if (W.dcAPI.isDisguised(player)) {
|
||||||
|
W.dcAPI.changePlayerDisguise(
|
||||||
|
player, disguise);
|
||||||
|
} else {
|
||||||
|
W.dcAPI.disguisePlayer(player,
|
||||||
|
disguise);
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageM.sendFMessage(
|
||||||
|
player,
|
||||||
|
ConfigC.normal_ingameNoMoreSolid,
|
||||||
|
true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,11 @@ public class OnPlayerCommandPreprocessEvent implements Listener {
|
|||||||
|| m.startsWith("/reload")) {
|
|| m.startsWith("/reload")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (arena.allowedCommands.contains(m)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MessageM.sendFMessage(player, ConfigC.warning_unableToCommand,
|
MessageM.sendFMessage(player, ConfigC.warning_unableToCommand,
|
||||||
true);
|
true);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -9,7 +9,9 @@ import nl.Steffion.BlockHunt.Managers.PlayerM;
|
|||||||
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
|
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
|
||||||
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
|
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
|
||||||
|
|
||||||
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -107,5 +109,27 @@ public class OnPlayerInteractEvent implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.getAction() == Action.LEFT_CLICK_BLOCK
|
||||||
|
|| event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||||
|
for (Arena arena : W.arenaList) {
|
||||||
|
if (arena.seekers.contains(player)) {
|
||||||
|
for (Player pl : arena.playersInArena) {
|
||||||
|
if (W.hiddenLoc.get(pl) != null) {
|
||||||
|
Block pLoc = event.getClickedBlock();
|
||||||
|
Block moveLocBlock = W.hiddenLoc.get(pl).getBlock();
|
||||||
|
if (moveLocBlock.getX() == pLoc.getX()
|
||||||
|
&& moveLocBlock.getY() == pLoc.getY()
|
||||||
|
&& moveLocBlock.getZ() == pLoc.getZ()) {
|
||||||
|
W.moveLoc.put(pl, player.getLocation());
|
||||||
|
player.getWorld().playEffect(
|
||||||
|
player.getLocation(), Effect.BOW_FIRE,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ public enum ConfigC {
|
|||||||
W.messages),
|
W.messages),
|
||||||
normal_ingameArenaEnd ("%NThe arena will end in %A%1%%N second(s)!",
|
normal_ingameArenaEnd ("%NThe arena will end in %A%1%%N second(s)!",
|
||||||
W.messages),
|
W.messages),
|
||||||
normal_HiderDied ("%NHider %A%playername%%N died! %A%left%%N hiders remain...",
|
normal_HiderDied ("%NHider %A%playername%%N died! %A%left%%N hider(s) remain...",
|
||||||
W.messages),
|
W.messages),
|
||||||
normal_SeekerDied ("%NSeeker %A%playername%%N died! He will respawn in %A%secs%%N seconds!",
|
normal_SeekerDied ("%NSeeker %A%playername%%N died! He will respawn in %A%secs%%N seconds!",
|
||||||
W.messages),
|
W.messages),
|
||||||
@ -96,6 +96,9 @@ public enum ConfigC {
|
|||||||
normal_winHiders ("%NThe %AHIDERS%N have won!", W.messages),
|
normal_winHiders ("%NThe %AHIDERS%N have won!", W.messages),
|
||||||
normal_setwarpWarpSet ("%NSet warp '%A%warp%%N' to your location!",
|
normal_setwarpWarpSet ("%NSet warp '%A%warp%%N' to your location!",
|
||||||
W.messages),
|
W.messages),
|
||||||
|
normal_ingameNowSolid ("%NYou're now a solid '%A%block%%N' block!",
|
||||||
|
W.messages),
|
||||||
|
normal_ingameNoMoreSolid ("%NYou're no longer a solid block!", W.messages),
|
||||||
|
|
||||||
warning_lobbyNeedAtleast ("%WYou need atleast %A%1%%W player(s) to start the game!",
|
warning_lobbyNeedAtleast ("%WYou need atleast %A%1%%W player(s) to start the game!",
|
||||||
W.messages),
|
W.messages),
|
||||||
@ -103,6 +106,8 @@ public enum ConfigC {
|
|||||||
W.messages),
|
W.messages),
|
||||||
warning_unableToCommand ("%WSorry but that command is disabled in the arena.",
|
warning_unableToCommand ("%WSorry but that command is disabled in the arena.",
|
||||||
W.messages),
|
W.messages),
|
||||||
|
warning_ingameNoSolidPlace ("%WThat's not a valid place to become solid!",
|
||||||
|
W.messages),
|
||||||
|
|
||||||
error_noPermission ("%EYou don't have the permissions to do that!",
|
error_noPermission ("%EYou don't have the permissions to do that!",
|
||||||
W.messages),
|
W.messages),
|
||||||
|
@ -4,15 +4,16 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import nl.Steffion.BlockHunt.Managers.ConfigM;
|
||||||
|
import nl.Steffion.BlockHunt.Managers.MessageM;
|
||||||
|
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
|
||||||
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import pgDev.bukkit.DisguiseCraft.api.DisguiseCraftAPI;
|
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.Managers.ConfigM;
|
import pgDev.bukkit.DisguiseCraft.api.DisguiseCraftAPI;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageM;
|
|
||||||
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
|
|
||||||
|
|
||||||
public class W {
|
public class W {
|
||||||
/*
|
/*
|
||||||
@ -47,6 +48,7 @@ public class W {
|
|||||||
public static HashMap<Player, Integer> pFood = new HashMap<Player, Integer>();
|
public static HashMap<Player, Integer> pFood = new HashMap<Player, Integer>();
|
||||||
|
|
||||||
public static HashMap<Player, Location> moveLoc = new HashMap<Player, Location>();
|
public static HashMap<Player, Location> moveLoc = new HashMap<Player, Location>();
|
||||||
|
public static HashMap<Player, Location> hiddenLoc = new HashMap<Player, Location>();
|
||||||
|
|
||||||
public static void newFiles() {
|
public static void newFiles() {
|
||||||
ConfigM.setDefaults();
|
ConfigM.setDefaults();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user