mirror of
https://github.com/darksaid98/AlathranWars.git
synced 2026-12-04 14:38:57 +00:00
feat: prevent move of town spawn in a war
This commit is contained in:
1 parent
18809a489a
commit
a4440c9283
1 file changed
+11
-4
@@ -7,10 +7,7 @@ import com.github.alathra.alathranwars.hooks.NameColorHandler;
|
|||||||
import com.github.milkdrinkers.colorparser.ColorParser;
|
import com.github.milkdrinkers.colorparser.ColorParser;
|
||||||
import com.palmergames.bukkit.towny.event.TownAddResidentEvent;
|
import com.palmergames.bukkit.towny.event.TownAddResidentEvent;
|
||||||
import com.palmergames.bukkit.towny.event.TownPreRenameEvent;
|
import com.palmergames.bukkit.towny.event.TownPreRenameEvent;
|
||||||
import com.palmergames.bukkit.towny.event.town.TownKickEvent;
|
import com.palmergames.bukkit.towny.event.town.*;
|
||||||
import com.palmergames.bukkit.towny.event.town.TownLeaveEvent;
|
|
||||||
import com.palmergames.bukkit.towny.event.town.TownPreMergeEvent;
|
|
||||||
import com.palmergames.bukkit.towny.event.town.TownRuinedEvent;
|
|
||||||
import com.palmergames.bukkit.towny.object.Town;
|
import com.palmergames.bukkit.towny.object.Town;
|
||||||
import net.kyori.adventure.key.Key;
|
import net.kyori.adventure.key.Key;
|
||||||
import net.kyori.adventure.sound.Sound;
|
import net.kyori.adventure.sound.Sound;
|
||||||
@@ -34,6 +31,16 @@ public class TownListener implements Listener {
|
|||||||
// TODO Allow renaming in war, update some vars pretty much
|
// TODO Allow renaming in war, update some vars pretty much
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
private void onSpawnMove(TownSetSpawnEvent e) {
|
||||||
|
Town town = e.getTown();
|
||||||
|
|
||||||
|
if (WarController.getInstance().isTownInAnyWars(town)) {
|
||||||
|
e.setCancelMessage("You can't move your town spawn while the town is in a war.");
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
private void onPlayerJoin(TownAddResidentEvent e) {
|
private void onPlayerJoin(TownAddResidentEvent e) {
|
||||||
Town town = e.getTown();
|
Town town = e.getTown();
|
||||||
|
|||||||
Reference in new issue
Block a user