mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-24 19:45:43 +01:00
Sign Checkpoint now Player Specific
This commit is contained in:
parent
b4bfb39b3d
commit
55becd07fc
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user