DungeonsXL/core/src/main/java/de/erethon/dungeonsxl/sign/passive/LobbySign.java

85 lines
2.1 KiB
Java

/*
* Copyright (C) 2012-2023 Frank Baumann
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.erethon.dungeonsxl.sign.passive;
import de.erethon.dungeonsxl.api.DungeonsAPI;
import de.erethon.dungeonsxl.api.sign.Passive;
import de.erethon.dungeonsxl.api.world.InstanceWorld;
import de.erethon.dungeonsxl.player.DPermission;
import de.erethon.dungeonsxl.sign.LocationSign;
import org.bukkit.Location;
import org.bukkit.block.Sign;
/**
* @author Frank Baumann, Daniel Saukel
*/
public class LobbySign extends Passive implements LocationSign {
private Location targetLocation;
public LobbySign(DungeonsAPI api, Sign sign, String[] lines, InstanceWorld instance) {
super(api, sign, lines, instance);
}
@Override
public Location getTargetLocation() {
return targetLocation;
}
@Override
public void setTargetLocation(Location location) {
this.targetLocation = location;
}
@Override
public String getName() {
return "Lobby";
}
@Override
public String getBuildPermission() {
return DPermission.SIGN.getNode() + ".lobby";
}
@Override
public boolean isOnDungeonInit() {
return true;
}
@Override
public boolean isProtected() {
return false;
}
@Override
public boolean isSetToAir() {
return true;
}
@Override
public boolean validate() {
return true;
}
@Override
public void initialize() {
LocationSign.super.initialize();
getGameWorld().setLobbyLocation(targetLocation);
}
}