From 55becd07fc1e227ac13daa8f2346b88147a82870 Mon Sep 17 00:00:00 2001 From: Sn0wStorm Date: Mon, 5 Aug 2013 19:49:42 +0200 Subject: [PATCH] Sign Checkpoint now Player Specific --- .../dre/dungeonsxl/signs/SIGNCheckpoint.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/com/dre/dungeonsxl/signs/SIGNCheckpoint.java b/src/com/dre/dungeonsxl/signs/SIGNCheckpoint.java index 15a4a2c4..dc87593b 100644 --- a/src/com/dre/dungeonsxl/signs/SIGNCheckpoint.java +++ b/src/com/dre/dungeonsxl/signs/SIGNCheckpoint.java @@ -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 done = new CopyOnWriteArrayList(); 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;