Remove "done" lists from signs where possible

This commit is contained in:
Daniel Saukel 2020-06-22 19:56:08 +02:00
parent df279742c6
commit 9a45ab0b6c
2 changed files with 2 additions and 23 deletions

View File

@ -21,8 +21,6 @@ import de.erethon.dungeonsxl.api.DungeonsAPI;
import de.erethon.dungeonsxl.api.dungeon.GameRule;
import de.erethon.dungeonsxl.api.sign.Button;
import de.erethon.dungeonsxl.api.world.InstanceWorld;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
@ -32,7 +30,6 @@ import org.bukkit.entity.Player;
public abstract class MessageSign extends Button {
protected String text = "UNKNOWN MESSAGE";
private List<Player> done = new ArrayList<>();
public MessageSign(DungeonsAPI api, Sign sign, String[] lines, InstanceWorld instance) {
super(api, sign, lines, instance);
@ -78,15 +75,7 @@ public abstract class MessageSign extends Button {
@Override
public boolean push(Player player) {
if (!done.contains(player)) {
sendMessage(player);
done.add(player);
}
if (done.size() >= getGameWorld().getWorld().getPlayers().size()) {
getGameWorld().removeDungeonSign(this);
}
sendMessage(player);
return true;
}

View File

@ -23,8 +23,6 @@ import de.erethon.dungeonsxl.api.DungeonsAPI;
import de.erethon.dungeonsxl.api.sign.Button;
import de.erethon.dungeonsxl.api.world.InstanceWorld;
import de.erethon.dungeonsxl.player.DPermission;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.SoundCategory;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
@ -38,7 +36,6 @@ public class SoundMessageSign extends Button {
private SoundCategory category;
private float volume;
private float pitch;
private List<Player> done = new ArrayList<>();
public SoundMessageSign(DungeonsAPI api, Sign sign, String[] lines, InstanceWorld instance) {
super(api, sign, lines, instance);
@ -112,14 +109,7 @@ public class SoundMessageSign extends Button {
@Override
public boolean push(Player player) {
if (!done.contains(player)) {
done.add(player);
playSound(player);
}
if (done.size() >= getGameWorld().getWorld().getPlayers().size()) {
getGameWorld().removeDungeonSign(this);
}
playSound(player);
return true;
}