Fix Item Cubes and Perma Night vision.

This commit is contained in:
sigonasr2 2016-08-17 06:03:52 -05:00
parent bc143da90e
commit 504017fe6b
3 changed files with 42 additions and 25 deletions

Binary file not shown.

View File

@ -34,6 +34,7 @@ public class DeathManager {
public static void removeDeathStructure(Player p) { public static void removeDeathStructure(Player p) {
ds.remove(getDeathStructure(p)); ds.remove(getDeathStructure(p));
p.removePotionEffect(PotionEffectType.GLOWING); p.removePotionEffect(PotionEffectType.GLOWING);
p.removePotionEffect(PotionEffectType.NIGHT_VISION);
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.deathloot.clear(); pd.deathloot.clear();
pd.hasDied=false; pd.hasDied=false;

View File

@ -1426,6 +1426,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//Update player max health. Check equipment too. //Update player max health. Check equipment too.
setPlayerMaxHealth(ev.getPlayer()); setPlayerMaxHealth(ev.getPlayer());
ev.getPlayer().removePotionEffect(PotionEffectType.GLOWING); ev.getPlayer().removePotionEffect(PotionEffectType.GLOWING);
ev.getPlayer().removePotionEffect(PotionEffectType.NIGHT_VISION);
ev.getPlayer().getScoreboard().getTeam(ev.getPlayer().getName().toLowerCase()).setSuffix(createHealthbar(((ev.getPlayer().getHealth())/ev.getPlayer().getMaxHealth())*100,ev.getPlayer())); ev.getPlayer().getScoreboard().getTeam(ev.getPlayer().getName().toLowerCase()).setSuffix(createHealthbar(((ev.getPlayer().getHealth())/ev.getPlayer().getMaxHealth())*100,ev.getPlayer()));
ev.getPlayer().getScoreboard().getTeam(ev.getPlayer().getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(ev.getPlayer())); ev.getPlayer().getScoreboard().getTeam(ev.getPlayer().getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(ev.getPlayer()));
ev.getPlayer().getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(4.0d); ev.getPlayer().getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(4.0d);
@ -3730,6 +3731,20 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
List<String> item_meta_lore = item_meta.getLore(); List<String> item_meta_lore = item_meta.getLore();
if (item_meta_lore.size()==4 && item_meta_lore.get(3).contains(ChatColor.DARK_PURPLE+"ID#")) { if (item_meta_lore.size()==4 && item_meta_lore.get(3).contains(ChatColor.DARK_PURPLE+"ID#")) {
int idnumb = Integer.parseInt(item_meta_lore.get(3).split("#")[1]); int idnumb = Integer.parseInt(item_meta_lore.get(3).split("#")[1]);
int itemcubeid = -1;
if (((PlayerStructure)playerdata.get(ev.getWhoClicked().getUniqueId())).isViewingItemCube &&
ev.getWhoClicked().getOpenInventory().getTitle().contains("Item Cube #")) {
itemcubeid = Integer.parseInt(ev.getWhoClicked().getOpenInventory().getTitle().split("#")[1]); //This is the ID of the window we are looking at, if one exists.
} else {
itemcubeid = -1;
}
if (idnumb==itemcubeid) {
//The inventory we are viewing is the same as the item cube we have clicked on!
//Stop this before the player does something dumb!
//Player p = ((Player)ev.getWhoClicked());
//p.playSound(p.getLocation(), Sound.BLOCK_NOTE_HARP, 0.4f, 0.2f);
ev.setCancelled(true);
} else {
log("This is an Item Cube.",5); log("This is an Item Cube.",5);
Player p = (Player)ev.getWhoClicked(); Player p = (Player)ev.getWhoClicked();
int inventory_size; int inventory_size;
@ -3762,6 +3777,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
} }
}
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void onItemSpawn(ItemSpawnEvent ev) { public void onItemSpawn(ItemSpawnEvent ev) {