disable nether and legendary fixes

This commit is contained in:
Ben 2016-03-09 21:12:02 +00:00
parent 70aa5d63fd
commit 1532abcc62
5 changed files with 57 additions and 86 deletions

View File

@ -392,7 +392,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "Replay|Restrict"); Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "Replay|Restrict");
new SiegeManager(this); new SiegeManager(this);
_netherManager = new NetherManager(this); // _netherManager = new NetherManager(this);
} }
@Override @Override

View File

@ -29,7 +29,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
* @author MrTwiggy * @author MrTwiggy
* *
*/ */
public class CustomItem implements Listener public class CustomItem
{ {
private static final ChatColor TITLE_COLOR = ChatColor.GOLD; // Chat color private static final ChatColor TITLE_COLOR = ChatColor.GOLD; // Chat color
@ -52,12 +52,12 @@ public class CustomItem implements Listener
} }
protected String _displayName; protected String _displayName;
private String[] _description; protected String[] _description;
private Material _material; protected Material _material;
private String _uuid; protected String _uuid;
private boolean _dullEnchantment; protected boolean _dullEnchantment;
public String OriginalOwner = null; public String OriginalOwner = null;
@ -73,8 +73,6 @@ public class CustomItem implements Listener
_material = material; _material = material;
_attributes = new AttributeContainer(); _attributes = new AttributeContainer();
_uuid = UUID.randomUUID().toString(); _uuid = UUID.randomUUID().toString();
UtilServer.RegisterEvents(this);
} }
public CustomItem(Material material) public CustomItem(Material material)
@ -95,34 +93,6 @@ public class CustomItem implements Listener
return _description; return _description;
} }
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
{
return;
}
final EnclosedObject<Boolean> success = new EnclosedObject<>(Boolean.FALSE);
UtilServer.getPlayersCollection().forEach(player -> {
PlayerGear gear = ClansManager.getInstance().getGearManager().getPlayerGear(player);
if (gear.getWeapon() == null)
return;
if (gear.getWeapon().getUuid().equals(getUuid()))
{
success.Set(Boolean.TRUE);
}
});
if (!success.Get().booleanValue())
{
UtilServer.Unregister(this);
}
}
public List<String> getLore() public List<String> getLore()
{ {
List<String> lore = new ArrayList<String>(); List<String> lore = new ArrayList<String>();

View File

@ -257,15 +257,6 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
} }
} }
@EventHandler
public void quit(PlayerQuitEvent event)
{
if (_playerGears.get(event.getPlayer().getName()) != null)
{
HandlerList.unregisterAll(_playerGears.get(event.getPlayer().getName()).getWeapon());
}
}
/** /**
* @param player - the player whose {@link PlayerGear} set is to be fetched. * @param player - the player whose {@link PlayerGear} set is to be fetched.
* @return the cached or newly instantiated {@link PlayerGear} associated * @return the cached or newly instantiated {@link PlayerGear} associated

View File

@ -163,7 +163,6 @@ public class PlayerGear
if (!itemsMatch(_weapon, weaponItem)) if (!itemsMatch(_weapon, weaponItem))
{ {
HandlerList.unregisterAll(_weapon);
_weapon = parseItem(weaponItem); _weapon = parseItem(weaponItem);
} }

View File

@ -6,15 +6,21 @@ import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.RGBData; import mineplex.core.common.util.RGBData;
import mineplex.core.common.util.UtilColor; import mineplex.core.common.util.UtilColor;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.core.repository.ClanTerritory; import mineplex.game.clans.core.repository.ClanTerritory;
@ -22,12 +28,46 @@ import mineplex.game.clans.items.PlayerGear;
public class RunedPickaxe extends RareItem public class RunedPickaxe extends RareItem
{ {
private long _lastFire = System.currentTimeMillis();
private long _interactWait;
private long _instamineEnabled; private long _instamineEnabled;
private RGBData[] colors = { UtilColor.RgbLightBlue, UtilColor.RgbLightBlue.Lighten(), UtilColor.RgbLightBlue.Darken() }; static
{
UtilServer.RegisterEvents(new Listener() {
@EventHandler(priority = EventPriority.LOWEST)
public void blockDamage(BlockDamageEvent event)
{
PlayerGear gear = ClansManager.getInstance().getGearManager().getPlayerGear(event.getPlayer());
if (!(gear.getWeapon() instanceof RunedPickaxe))
{
return;
}
System.out.println(event.getBlock());
RunedPickaxe pick = (RunedPickaxe) gear.getWeapon();
String playerClan = ClansManager.getInstance().getClanUtility().getClanByPlayer(event.getPlayer()) == null ? null : ClansManager.getInstance().getClanUtility().getClanByPlayer(event.getPlayer()).getName();
ClanTerritory territory = ClansManager.getInstance().getClanUtility().getClaim(event.getBlock().getLocation());
if (territory != null && !territory.Owner.equals(playerClan))
return;
if (event.getBlock().getType() == Material.BEDROCK)
return;
if (!UtilTime.elapsed(pick._instamineEnabled, 12000))
{
event.getBlock().breakNaturally();
event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.TILE_BREAK, event.getBlock().getType(), 10);
event.getPlayer().playSound(event.getBlock().getLocation(), Sound.LAVA_POP, 1.f, 1.f);
}
}
});
}
public RunedPickaxe() public RunedPickaxe()
{ {
@ -36,48 +76,19 @@ public class RunedPickaxe extends RareItem
}, LineFormat.LORE), Material.RECORD_8); }, LineFormat.LORE), Material.RECORD_8);
} }
@Override public void onInteract(PlayerInteractEvent event)
public void update(Player wielder)
{ {
if ((System.currentTimeMillis() - _lastBlock) < 98) if (!UtilEvent.isAction(event, ActionType.R))
System.out.println((System.currentTimeMillis() - _lastBlock) + ", " + (System.currentTimeMillis() - _interactWait));
if ((System.currentTimeMillis() - _lastBlock) < 98 && (System.currentTimeMillis() - _interactWait) >= 98)
{ {
_interactWait = System.currentTimeMillis(); return;
if (Recharge.Instance.use(wielder, "Instant Mine", 30000, true, true))
{
_instamineEnabled = System.currentTimeMillis();
}
} }
}
@EventHandler(priority = EventPriority.LOWEST) if (Recharge.Instance.use(event.getPlayer(), "Instant Mine", 30000, true, true))
public void blockDamage(BlockDamageEvent event)
{
PlayerGear gear = ClansManager.getInstance().getGearManager().getPlayerGear(event.getPlayer());
System.out.println(event.getBlock());
String playerClan = ClansManager.getInstance().getClanUtility().getClanByPlayer(event.getPlayer()) == null ? null : ClansManager.getInstance().getClanUtility().getClanByPlayer(event.getPlayer()).getName();
ClanTerritory territory = ClansManager.getInstance().getClanUtility().getClaim(event.getBlock().getLocation());
if (territory != null && !territory.Owner.equals(playerClan))
return;
if (event.getBlock().getType() == Material.BEDROCK)
return;
if (equals(gear.getWeapon()) && !UtilTime.elapsed(_instamineEnabled, 12000))
{ {
event.getBlock().breakNaturally(); _instamineEnabled = System.currentTimeMillis();
event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, event.getBlock().getType(), 10);
event.getPlayer().playSound(event.getBlock().getLocation(), Sound.LAVA_POP, 1.f, 1.f);
} }
super.onInteract(event);
} }
} }