mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-24 19:45:43 +01:00
Remove "done" lists from signs where possible
This commit is contained in:
parent
df279742c6
commit
9a45ab0b6c
@ -21,8 +21,6 @@ import de.erethon.dungeonsxl.api.DungeonsAPI;
|
|||||||
import de.erethon.dungeonsxl.api.dungeon.GameRule;
|
import de.erethon.dungeonsxl.api.dungeon.GameRule;
|
||||||
import de.erethon.dungeonsxl.api.sign.Button;
|
import de.erethon.dungeonsxl.api.sign.Button;
|
||||||
import de.erethon.dungeonsxl.api.world.InstanceWorld;
|
import de.erethon.dungeonsxl.api.world.InstanceWorld;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -32,7 +30,6 @@ import org.bukkit.entity.Player;
|
|||||||
public abstract class MessageSign extends Button {
|
public abstract class MessageSign extends Button {
|
||||||
|
|
||||||
protected String text = "UNKNOWN MESSAGE";
|
protected String text = "UNKNOWN MESSAGE";
|
||||||
private List<Player> done = new ArrayList<>();
|
|
||||||
|
|
||||||
public MessageSign(DungeonsAPI api, Sign sign, String[] lines, InstanceWorld instance) {
|
public MessageSign(DungeonsAPI api, Sign sign, String[] lines, InstanceWorld instance) {
|
||||||
super(api, sign, lines, instance);
|
super(api, sign, lines, instance);
|
||||||
@ -78,15 +75,7 @@ public abstract class MessageSign extends Button {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean push(Player player) {
|
public boolean push(Player player) {
|
||||||
if (!done.contains(player)) {
|
|
||||||
sendMessage(player);
|
sendMessage(player);
|
||||||
done.add(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (done.size() >= getGameWorld().getWorld().getPlayers().size()) {
|
|
||||||
getGameWorld().removeDungeonSign(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,8 +23,6 @@ import de.erethon.dungeonsxl.api.DungeonsAPI;
|
|||||||
import de.erethon.dungeonsxl.api.sign.Button;
|
import de.erethon.dungeonsxl.api.sign.Button;
|
||||||
import de.erethon.dungeonsxl.api.world.InstanceWorld;
|
import de.erethon.dungeonsxl.api.world.InstanceWorld;
|
||||||
import de.erethon.dungeonsxl.player.DPermission;
|
import de.erethon.dungeonsxl.player.DPermission;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import org.bukkit.SoundCategory;
|
import org.bukkit.SoundCategory;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -38,7 +36,6 @@ public class SoundMessageSign extends Button {
|
|||||||
private SoundCategory category;
|
private SoundCategory category;
|
||||||
private float volume;
|
private float volume;
|
||||||
private float pitch;
|
private float pitch;
|
||||||
private List<Player> done = new ArrayList<>();
|
|
||||||
|
|
||||||
public SoundMessageSign(DungeonsAPI api, Sign sign, String[] lines, InstanceWorld instance) {
|
public SoundMessageSign(DungeonsAPI api, Sign sign, String[] lines, InstanceWorld instance) {
|
||||||
super(api, sign, lines, instance);
|
super(api, sign, lines, instance);
|
||||||
@ -112,14 +109,7 @@ public class SoundMessageSign extends Button {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean push(Player player) {
|
public boolean push(Player player) {
|
||||||
if (!done.contains(player)) {
|
|
||||||
done.add(player);
|
|
||||||
playSound(player);
|
playSound(player);
|
||||||
}
|
|
||||||
|
|
||||||
if (done.size() >= getGameWorld().getWorld().getPlayers().size()) {
|
|
||||||
getGameWorld().removeDungeonSign(this);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user