Sign Checkpoint now Player Specific

This commit is contained in:
Sn0wStorm 2013-08-05 19:49:42 +02:00
parent b4bfb39b3d
commit 55becd07fc

View File

@ -1,6 +1,8 @@
package com.dre.dungeonsxl.signs;
import java.util.concurrent.CopyOnWriteArrayList;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
import com.dre.dungeonsxl.DPlayer;
import com.dre.dungeonsxl.P;
@ -14,6 +16,7 @@ public class SIGNCheckpoint extends DSign {
// Variables
private boolean initialized;
private CopyOnWriteArrayList<DPlayer> done = new CopyOnWriteArrayList<DPlayer>();
public SIGNCheckpoint(Sign sign, GameWorld gworld) {
super(sign, gworld);
@ -45,6 +48,24 @@ public class SIGNCheckpoint extends DSign {
}
}
@Override
public boolean onPlayerTrigger(Player player) {
if (initialized) {
DPlayer dplayer = DPlayer.get(player);
if (dplayer != null) {
if (!done.contains(dplayer)) {
done.add(dplayer);
dplayer.setCheckpoint(this.sign.getLocation());
P.p.msg(player, P.p.language.get("Player_CheckpointReached"));
}
}
if (done.size() >= DPlayer.get(this.gworld.world).size()) {
remove();
}
}
return true;
}
@Override
public String getPermissions() {
return buildPermissions;