Added Spawner Lock Command, And Formatted Grace Differently
This commit is contained in:
parent
8df75a59d4
commit
41fb4dd7ad
@ -84,6 +84,7 @@ public class Conf {
|
||||
public static int stealthFlyCheckRadius = 32;
|
||||
public static int factionBufferSize = 20;
|
||||
public static boolean useCheckSystem = true;
|
||||
public static boolean spawnerLock = false;
|
||||
public static boolean gracePeriod = false;
|
||||
public static boolean noEnderpearlsInFly = false;
|
||||
public static boolean broadcastDescriptionChanges = false;
|
||||
|
@ -0,0 +1,29 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class CmdSpawnerLock extends FCommand {
|
||||
|
||||
public CmdSpawnerLock(){
|
||||
super();
|
||||
this.aliases.add("lockspawners");
|
||||
this.aliases.add("spawnerlock");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.LOCKSPAWNERS)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context){
|
||||
Conf.spawnerLock = !Conf.spawnerLock;
|
||||
context.msg(TL.COMMAND_SPAWNER_LOCK_TOGGLED, Conf.spawnerLock ? FactionsPlugin.getInstance().color("&aEnabled") : FactionsPlugin.getInstance().color("&4Disabled"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_SPAWNER_LOCK_DESCRIPTION;
|
||||
}
|
||||
}
|
@ -146,6 +146,7 @@ public class FCmdRoot extends FCommand implements CommandExecutor {
|
||||
public CmdCheck cmdCheck = new CmdCheck();
|
||||
public CmdWeeWoo cmdWeeWoo = new CmdWeeWoo();
|
||||
public CmdConvertConfig cmdConvertConfig = new CmdConvertConfig();
|
||||
public CmdSpawnerLock cmdSpawnerLock = new CmdSpawnerLock();
|
||||
|
||||
public FCmdRoot() {
|
||||
super();
|
||||
@ -255,6 +256,7 @@ public class FCmdRoot extends FCommand implements CommandExecutor {
|
||||
this.addSubCommand(this.cmdFGlobal);
|
||||
this.addSubCommand(this.cmdViewChest);
|
||||
this.addSubCommand(this.cmdConvertConfig);
|
||||
this.addSubCommand(this.cmdSpawnerLock);
|
||||
|
||||
if (Conf.useCheckSystem) {
|
||||
this.addSubCommand(this.cmdCheck);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.massivecraft.factions.cmd.grace;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.cmd.CommandContext;
|
||||
import com.massivecraft.factions.cmd.CommandRequirements;
|
||||
import com.massivecraft.factions.cmd.FCommand;
|
||||
@ -21,7 +22,7 @@ public class CmdGrace extends FCommand {
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
Conf.gracePeriod = !Conf.gracePeriod;
|
||||
context.msg(TL.COMMAND_GRACE_TOGGLE, Conf.gracePeriod ? TL.GENERIC_ENABLED : TL.GENERIC_DISABLED);
|
||||
context.msg(TL.COMMAND_GRACE_TOGGLE, Conf.gracePeriod ? FactionsPlugin.getInstance().color("&aEnabled") : FactionsPlugin.getInstance().color("&4Disabled"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -155,6 +155,14 @@ public class FactionsBlockListener implements Listener {
|
||||
|
||||
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "build", false)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getBlock().getType().equals(XMaterial.SPAWNER.parseMaterial())) {
|
||||
if (Conf.spawnerLock) {
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().sendMessage(FactionsPlugin.getInstance().color(TL.COMMAND_SPAWNER_LOCK_CANNOT_PLACE.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,7 @@ public enum Permission {
|
||||
LEAVE("leave"),
|
||||
LIST("list"),
|
||||
LOCK("lock"),
|
||||
LOCKSPAWNERS("lockspawners"),
|
||||
LOGOUT("logout"),
|
||||
MAP("map"),
|
||||
MAPHEIGHT("mapheight"),
|
||||
|
@ -706,6 +706,10 @@ public enum TL {
|
||||
COMMAND_SETMAXVAULTS_SUCCESS("&aSet max vaults for &e%s &ato &b%d"),
|
||||
COMMAND_ONCOOOLDOWN("&c&l[!] &7You cannot use this command for another &b%1$s &7seconds."),
|
||||
|
||||
COMMAND_SPAWNER_LOCK_TOGGLED("&c&l[!] &7You have set placement of spawners to %1$s"),
|
||||
COMMAND_SPAWNER_LOCK_DESCRIPTION("enable/disable placement of spawners"),
|
||||
COMMAND_SPAWNER_LOCK_CANNOT_PLACE("&c&l[!] &7Placement of spawners has been temporarily disabled!"),
|
||||
|
||||
COMMAND_STRIKES_CHANGED("&c&l[!] &7You have set &c%1$s's &7strikes to &c%2$s"),
|
||||
COMMAND_STRIKES_INFO("&c&l[!] &7%1$s has %2$s strikes"),
|
||||
COMMAND_STRIKES_TARGET_INVALID("&c&l[!] &7The faction %1$s is invalid."),
|
||||
|
@ -188,6 +188,8 @@ permissions:
|
||||
description: see a list of the factions
|
||||
factions.lock:
|
||||
description: lock all write stuff
|
||||
factions.lockspawners:
|
||||
description: toggle placement of spawners
|
||||
factions.managesafezone:
|
||||
description: claim land as a safe zone and build/destroy within safe zones
|
||||
factions.managewarzone:
|
||||
|
Loading…
Reference in New Issue
Block a user