finally fixed that windblade dupe

This commit is contained in:
NewGarbo 2016-01-25 17:41:07 +00:00
parent 71bb1ed3d6
commit 18e892c4ec
3 changed files with 29 additions and 3 deletions

View File

@ -1,6 +1,5 @@
package mineplex.game.clans.clans.ban.commands;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;

View File

@ -1,6 +1,8 @@
package mineplex.game.clans.gameplay.safelog;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -49,6 +51,12 @@ public class SafeLog extends MiniPlugin
isSafeLog = true;
}
if (_flying.contains(player.getName()))
{
_flying.remove(player.getName());
return;
}
if (!isSafeLog)
{
NPCManager.getInstance().spawnLogoutNpc(player);
@ -93,6 +101,8 @@ public class SafeLog extends MiniPlugin
}
}
}
private List<String> _flying = new ArrayList<>();
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerQuit(PlayerQuitEvent event)
@ -101,6 +111,16 @@ public class SafeLog extends MiniPlugin
onPlayerQuit(event.getPlayer());
}
@EventHandler(priority = EventPriority.HIGHEST)
public void flyCheck(PlayerKickEvent event)
{
if (event.getPlayer().getItemInHand() != null && event.getPlayer().getItemInHand().getItemMeta() != null && (C.cGold + "Wind Blade").equals(event.getPlayer().getItemInHand().getItemMeta().getDisplayName()))
if (event.getReason().contains("flying is not enabled"))
return;
_flying.add(event.getPlayer().getName());
}
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerKicked(PlayerKickEvent event)

View File

@ -211,15 +211,22 @@ public class NPCManager extends MiniPlugin
{
CombatLogNPC npc = iterator.next();
if (Bukkit.getPlayer(npc.getPlayerInfo().getPlayerName()) != null)
{
System.out.println("{NPCMANAGER} ORIGINAL PLAYER ALIVE AND DESPAWNING");
npc.despawn();
iterator.remove();
}
if (!npc.isAlive())
{
System.out.println("NOT ALIVE AND REMOVING");
System.out.println("{NPCMANAGER} NOT ALIVE AND REMOVING");
npc.remove();
iterator.remove();
}
else if (npc.getAliveDuation() > COMBAT_LOG_DURATION)
{
System.out.println("DESPAWNING");
System.out.println("{NPCMANAGER} DESPAWNING");
npc.despawn();
iterator.remove();
}