~ Changed from DisguiseCraft to LibsDisguises.

This commit is contained in:
Steffion 2013-09-28 21:42:51 +02:00
parent 8d1e2cc705
commit 2f1b604a37
6 changed files with 35 additions and 55 deletions

View File

@ -3,6 +3,7 @@ package nl.Steffion.BlockHunt;
import java.util.ArrayList;
import java.util.List;
import me.libraryaddict.disguise.DisguiseAPI;
import nl.Steffion.BlockHunt.Arena.ArenaState;
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
import nl.Steffion.BlockHunt.Managers.MessageM;
@ -151,9 +152,7 @@ public class ArenaHandler {
}
player.updateInventory();
if (W.dcAPI.isDisguised(player)) {
W.dcAPI.undisguisePlayer(player);
}
DisguiseAPI.undisguiseToAll(player);
ArenaHandler.sendFMessage(arena,
ConfigC.normal_joinJoinedArena,
@ -246,7 +245,7 @@ public class ArenaHandler {
ArenaHandler.sendFMessage(arena,
ConfigC.normal_ingameSeekerChoosen, "seeker-"
+ seeker.getName());
W.dcAPI.undisguisePlayer(seeker);
DisguiseAPI.undisguiseToAll(seeker);
for (Player pl : Bukkit.getOnlinePlayers()) {
pl.showPlayer(seeker);
}
@ -293,9 +292,7 @@ public class ArenaHandler {
}
}
if (W.dcAPI.isDisguised(player)) {
W.dcAPI.undisguisePlayer(player);
}
DisguiseAPI.undisguiseToAll(player);
}
ScoreboardHandler.removeScoreboard(player);

View File

@ -2,9 +2,11 @@ package nl.Steffion.BlockHunt;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
import nl.Steffion.BlockHunt.Arena.ArenaState;
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
import nl.Steffion.BlockHunt.Commands.CMDcreate;
@ -20,8 +22,8 @@ import nl.Steffion.BlockHunt.Commands.CMDset;
import nl.Steffion.BlockHunt.Commands.CMDsetwarp;
import nl.Steffion.BlockHunt.Commands.CMDshop;
import nl.Steffion.BlockHunt.Commands.CMDstart;
import nl.Steffion.BlockHunt.Commands.CMDwand;
import nl.Steffion.BlockHunt.Commands.CMDtokens;
import nl.Steffion.BlockHunt.Commands.CMDwand;
import nl.Steffion.BlockHunt.Listeners.OnBlockBreakEvent;
import nl.Steffion.BlockHunt.Listeners.OnBlockPlaceEvent;
import nl.Steffion.BlockHunt.Listeners.OnEntityDamageByEntityEvent;
@ -62,10 +64,6 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
import pgDev.bukkit.DisguiseCraft.DisguiseCraft;
import pgDev.bukkit.DisguiseCraft.disguise.Disguise;
import pgDev.bukkit.DisguiseCraft.disguise.DisguiseType;
public class BlockHunt extends JavaPlugin implements Listener {
/**
* Steffion's Engine - Made by Steffion.
@ -153,6 +151,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
ConfigurationSerialization.registerClass(Arena.class, "BlockHuntArena");
pdfFile = getDescription();
plugin = this;
ConfigM.newFiles();
@ -223,16 +222,14 @@ public class BlockHunt extends JavaPlugin implements Listener {
BlockHuntCMD, new CMDtokens(),
"/BlockHunt <tokens|t> <set|add|take> <playername> <amount>");
if (!getServer().getPluginManager().isPluginEnabled("DisguiseCraft")) {
MessageM.broadcastFMessage(ConfigC.error_disguiseCraftNotInstalled);
if (!getServer().getPluginManager().isPluginEnabled("LibsDisguises")) {
MessageM.broadcastFMessage(ConfigC.error_libsDisguisesNotInstalled);
}
if (!getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
MessageM.broadcastFMessage(ConfigC.error_protocolLibNotInstalled);
}
W.dcAPI = DisguiseCraft.getAPI();
ArenaHandler.loadArenas();
Bukkit.getScheduler().runTaskTimer(this, new Runnable() {
@ -293,7 +290,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
"%TAG%EUnable to send %AMCStats %Eto the server. Something went wrong ;(!");
}
}
}, 0, 100);
}, 0, 6000);
if ((Boolean) W.config.get(ConfigC.autoUpdateCheck)) {
if ((Boolean) W.config.get(ConfigC.autoDownloadUpdate)) {
@ -412,20 +409,12 @@ public class BlockHunt extends JavaPlugin implements Listener {
W.choosenBlock.remove(arenaPlayer);
}
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(arenaPlayer)) {
W.dcAPI.changePlayerDisguise(
arenaPlayer, disguise);
} else {
W.dcAPI.disguisePlayer(arenaPlayer,
disguise);
}
MiscDisguise disguise = new MiscDisguise(
DisguiseType.FALLING_BLOCK, block
.getTypeId(), block
.getDurability());
DisguiseAPI.disguiseToAll(arenaPlayer,
disguise);
arenaPlayer.teleport(arena.hidersWarp);
@ -608,8 +597,10 @@ public class BlockHunt extends JavaPlugin implements Listener {
W.hiddenLocWater.put(
player, false);
}
if (W.dcAPI.isDisguised(player)) {
W.dcAPI.undisguisePlayer(player);
if (DisguiseAPI
.isDisguised(player)) {
DisguiseAPI
.undisguiseToAll(player);
for (Player pl : Bukkit
.getOnlinePlayers()) {
if (!pl.equals(player)) {
@ -681,7 +672,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
}
} else {
block.setAmount(5);
if (!W.dcAPI.isDisguised(player)) {
if (!DisguiseAPI.isDisguised(player)) {
SolidBlockHandler
.makePlayerUnsolid(player);
}

View File

@ -187,7 +187,7 @@ public enum ConfigC {
W.messages),
error_notEnoughArguments ("%TAG%EYou're missing arguments, correct syntax: %A%syntax%",
W.messages),
error_disguiseCraftNotInstalled ("%TAG%EThe plugin '%ADisguiseCraft%E' is required to run this plugin! Intall it or it won't work!",
error_libsDisguisesNotInstalled ("%TAG%EThe plugin '%ALib's Disguises%E' is required to run this plugin! Intall it or it won't work!",
W.messages),
error_protocolLibNotInstalled ("%TAG%EThe plugin '%AProtocolLib%E' is required to run this plugin! Intall it or it won't work!",
W.messages),

View File

@ -1,5 +1,6 @@
package nl.Steffion.BlockHunt.Listeners;
import me.libraryaddict.disguise.DisguiseAPI;
import nl.Steffion.BlockHunt.Arena;
import nl.Steffion.BlockHunt.Arena.ArenaState;
import nl.Steffion.BlockHunt.ArenaHandler;
@ -54,7 +55,7 @@ public class OnEntityDamageByEntityEvent implements Listener {
player.setHealth(20);
event.setCancelled(true);
W.dcAPI.undisguisePlayer(player);
DisguiseAPI.undisguiseToAll(player);
W.pBlock.remove(player);
if (!arena.seekers.contains(player)) {
@ -121,7 +122,7 @@ public class OnEntityDamageByEntityEvent implements Listener {
.size()) {
ArenaHandler.seekersWin(arena);
} else {
W.dcAPI.undisguisePlayer(player);
DisguiseAPI.undisguiseToAll(player);
W.seekertime.put(player,
arena.waitingTimeSeeker);
player.teleport(arena.seekersWarp);

View File

@ -1,7 +1,8 @@
package nl.Steffion.BlockHunt;
import java.util.LinkedList;
import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
import nl.Steffion.BlockHunt.Managers.MessageM;
import org.bukkit.Bukkit;
@ -12,9 +13,6 @@ import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import pgDev.bukkit.DisguiseCraft.disguise.Disguise;
import pgDev.bukkit.DisguiseCraft.disguise.DisguiseType;
public class SolidBlockHandler {
public static void makePlayerUnsolid(Player player) {
ItemStack block = player.getInventory().getItem(8);
@ -47,16 +45,12 @@ public class SolidBlockHandler {
player.playSound(player.getLocation(), 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);
for (Player playerShow : Bukkit.getOnlinePlayers()) {
playerShow.showPlayer(player);
}
MiscDisguise disguise = new MiscDisguise(DisguiseType.FALLING_BLOCK,
block.getTypeId(), block.getDurability());
DisguiseAPI.disguiseToAll(player, disguise);
MessageM.sendFMessage(player, ConfigC.normal_ingameNoMoreSolid);
}

View File

@ -12,8 +12,6 @@ import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import pgDev.bukkit.DisguiseCraft.api.DisguiseCraftAPI;
public class W {
/**
* Steffion's Engine - Made by Steffion.
@ -51,7 +49,6 @@ public class W {
public static ArrayList<Arena> arenaList = new ArrayList<Arena>();
public static Random random = new Random();
public static DisguiseCraftAPI dcAPI;
public static HashMap<Player, Integer> seekertime = new HashMap<Player, Integer>();
public static HashMap<Player, PlayerArenaData> pData = new HashMap<Player, PlayerArenaData>();