Impl all commands but TBMEdit for 1.14
This commit is contained in:
parent
6c49470509
commit
62df136fae
6 changed files with 76 additions and 352 deletions
|
@ -1,61 +0,0 @@
|
||||||
package com.seodisparate.TurnBasedMinecraft.common;
|
|
||||||
|
|
||||||
import com.seodisparate.TurnBasedMinecraft.common.networking.PacketGeneralMessage;
|
|
||||||
|
|
||||||
import net.minecraft.command.CommandBase;
|
|
||||||
import net.minecraft.command.CommandException;
|
|
||||||
import net.minecraft.command.ICommandSender;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
|
|
||||||
public class CommandTBMDisable extends CommandBase
|
|
||||||
{
|
|
||||||
public static final String usage = "/tbm-disable (Disables turn-based-battle for the current player (only OP or anyone, depending on config))";
|
|
||||||
private Config config;
|
|
||||||
|
|
||||||
CommandTBMDisable(Config config)
|
|
||||||
{
|
|
||||||
this.config = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return "tbm-disable";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUsage(ICommandSender sender)
|
|
||||||
{
|
|
||||||
return usage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
|
|
||||||
{
|
|
||||||
EntityPlayerMP player = null;
|
|
||||||
player = getCommandSenderAsPlayer(sender);
|
|
||||||
if(!config.getIfOnlyOPsCanDisableTurnBasedForSelf() || player.getServer().isSinglePlayer() || player.getServer().getPlayerList().getOppedPlayers().getEntry(player.getGameProfile()) != null)
|
|
||||||
{
|
|
||||||
config.addBattleIgnoringPlayer(player.getEntityId());
|
|
||||||
TurnBasedMinecraftMod.NWINSTANCE.sendTo(new PacketGeneralMessage("Disabled turn-based-combat for current player"), player);
|
|
||||||
TurnBasedMinecraftMod.logger.info("Disabled turn-based-combat for " + player.getName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TurnBasedMinecraftMod.NWINSTANCE.sendTo(new PacketGeneralMessage("Only OPs can use this command (based on config)"), player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRequiredPermissionLevel()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean checkPermission(MinecraftServer server, ICommandSender sender)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,67 +0,0 @@
|
||||||
package com.seodisparate.TurnBasedMinecraft.common;
|
|
||||||
|
|
||||||
import com.seodisparate.TurnBasedMinecraft.common.networking.PacketGeneralMessage;
|
|
||||||
|
|
||||||
import net.minecraft.command.CommandBase;
|
|
||||||
import net.minecraft.command.CommandException;
|
|
||||||
import net.minecraft.command.ICommandSender;
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
|
|
||||||
public class CommandTBMDisableAll extends CommandBase
|
|
||||||
{
|
|
||||||
public static final String usage = "/tbm-disable-all (Disables turn-based-battle for everyone";
|
|
||||||
private Config config;
|
|
||||||
|
|
||||||
public CommandTBMDisableAll(Config config)
|
|
||||||
{
|
|
||||||
this.config = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return "tbm-disable-all";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUsage(ICommandSender sender)
|
|
||||||
{
|
|
||||||
return usage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
|
|
||||||
{
|
|
||||||
config.setBattleDisabledForAll(true);
|
|
||||||
for(Entity player : server.getPlayerList().getPlayers())
|
|
||||||
{
|
|
||||||
config.addBattleIgnoringPlayer(player.getEntityId());
|
|
||||||
}
|
|
||||||
EntityPlayerMP senderPlayer = null;
|
|
||||||
try {
|
|
||||||
senderPlayer = getCommandSenderAsPlayer(sender);
|
|
||||||
} catch(Throwable t)
|
|
||||||
{
|
|
||||||
// Ignore case when sender EntityPlayer cannot be found
|
|
||||||
}
|
|
||||||
if(senderPlayer != null)
|
|
||||||
{
|
|
||||||
TurnBasedMinecraftMod.logger.info(senderPlayer.getName() + " disabled turn-based-combat for everyone");
|
|
||||||
TurnBasedMinecraftMod.NWINSTANCE.sendToAll(new PacketGeneralMessage(senderPlayer.getName() + " disabled turn-based-battle for everyone"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TurnBasedMinecraftMod.logger.info("An admin disabled turn-based-combat for everyone");
|
|
||||||
TurnBasedMinecraftMod.NWINSTANCE.sendToAll(new PacketGeneralMessage("An admin disabled turn-based-battle for everyone"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRequiredPermissionLevel()
|
|
||||||
{
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
package com.seodisparate.TurnBasedMinecraft.common;
|
|
||||||
|
|
||||||
import com.seodisparate.TurnBasedMinecraft.common.networking.PacketGeneralMessage;
|
|
||||||
|
|
||||||
import net.minecraft.command.CommandBase;
|
|
||||||
import net.minecraft.command.CommandException;
|
|
||||||
import net.minecraft.command.ICommandSender;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
|
|
||||||
public class CommandTBMEnable extends CommandBase
|
|
||||||
{
|
|
||||||
public static final String usage = "/tbm-enable (Enables turn-based-battle for the current player (only OP or anyone, depending on config))";
|
|
||||||
private Config config;
|
|
||||||
|
|
||||||
CommandTBMEnable(Config config)
|
|
||||||
{
|
|
||||||
this.config = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return "tbm-enable";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUsage(ICommandSender sender)
|
|
||||||
{
|
|
||||||
return usage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
|
|
||||||
{
|
|
||||||
EntityPlayerMP player = null;
|
|
||||||
player = getCommandSenderAsPlayer(sender);
|
|
||||||
if(!config.getIfOnlyOPsCanDisableTurnBasedForSelf() || player.getServer().isSinglePlayer() || player.getServer().getPlayerList().getOppedPlayers().getEntry(player.getGameProfile()) != null)
|
|
||||||
{
|
|
||||||
config.removeBattleIgnoringPlayer(player.getEntityId());
|
|
||||||
TurnBasedMinecraftMod.NWINSTANCE.sendTo(new PacketGeneralMessage("Enabled turn-based-combat for current player"), player);
|
|
||||||
TurnBasedMinecraftMod.logger.info("Enabled turn-based-combat for " + player.getName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TurnBasedMinecraftMod.NWINSTANCE.sendTo(new PacketGeneralMessage("Only OPs can use this command (based on config)"), player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRequiredPermissionLevel()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean checkPermission(MinecraftServer server, ICommandSender sender)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,62 +0,0 @@
|
||||||
package com.seodisparate.TurnBasedMinecraft.common;
|
|
||||||
|
|
||||||
import com.seodisparate.TurnBasedMinecraft.common.networking.PacketGeneralMessage;
|
|
||||||
|
|
||||||
import net.minecraft.command.CommandBase;
|
|
||||||
import net.minecraft.command.CommandException;
|
|
||||||
import net.minecraft.command.ICommandSender;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
|
|
||||||
public class CommandTBMEnableAll extends CommandBase
|
|
||||||
{
|
|
||||||
public static final String usage = "/tbm-enable-all (enables turn-based-combat for everyone)";
|
|
||||||
private Config config;
|
|
||||||
|
|
||||||
public CommandTBMEnableAll(Config config)
|
|
||||||
{
|
|
||||||
this.config = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return "tbm-enable-all";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUsage(ICommandSender sender)
|
|
||||||
{
|
|
||||||
return usage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
|
|
||||||
{
|
|
||||||
config.setBattleDisabledForAll(false);
|
|
||||||
config.clearBattleIgnoringPlayers();
|
|
||||||
EntityPlayerMP senderPlayer = null;
|
|
||||||
try {
|
|
||||||
senderPlayer = getCommandSenderAsPlayer(sender);
|
|
||||||
} catch(Throwable t)
|
|
||||||
{
|
|
||||||
// Ignore case when sender EntityPlayer cannot be found
|
|
||||||
}
|
|
||||||
if(senderPlayer != null)
|
|
||||||
{
|
|
||||||
TurnBasedMinecraftMod.logger.info(senderPlayer.getName() + " enabled turn-based-combat for everyone");
|
|
||||||
TurnBasedMinecraftMod.NWINSTANCE.sendToAll(new PacketGeneralMessage(senderPlayer.getName() + " enabled turn-based-combat for everyone"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TurnBasedMinecraftMod.logger.info("An admin enabled turn-based-combat for everyone");
|
|
||||||
TurnBasedMinecraftMod.NWINSTANCE.sendToAll(new PacketGeneralMessage("An admin enabled turn-based-combat for everyone"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRequiredPermissionLevel()
|
|
||||||
{
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,96 +0,0 @@
|
||||||
package com.seodisparate.TurnBasedMinecraft.common;
|
|
||||||
|
|
||||||
import com.seodisparate.TurnBasedMinecraft.common.networking.PacketGeneralMessage;
|
|
||||||
|
|
||||||
import net.minecraft.command.CommandBase;
|
|
||||||
import net.minecraft.command.CommandException;
|
|
||||||
import net.minecraft.command.ICommandSender;
|
|
||||||
import net.minecraft.command.WrongUsageException;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
|
|
||||||
public class CommandTBMSet extends CommandBase
|
|
||||||
{
|
|
||||||
public static final String usage = "/tbm-set <player> <true or false; if true turn-based-battle is enabled for that player>";
|
|
||||||
private Config config;
|
|
||||||
|
|
||||||
public CommandTBMSet(Config config)
|
|
||||||
{
|
|
||||||
this.config = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return "tbm-set";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUsage(ICommandSender sender)
|
|
||||||
{
|
|
||||||
return usage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
|
|
||||||
{
|
|
||||||
if(args.length != 2)
|
|
||||||
{
|
|
||||||
throw new WrongUsageException(usage, new Object[0]);
|
|
||||||
}
|
|
||||||
EntityPlayerMP target = getPlayer(server, sender, args[0]);
|
|
||||||
EntityPlayerMP senderPlayer = null;
|
|
||||||
try {
|
|
||||||
senderPlayer = getCommandSenderAsPlayer(sender);
|
|
||||||
} catch(Throwable t)
|
|
||||||
{
|
|
||||||
// Ignore case when sender EntityPlayer cannot be found
|
|
||||||
}
|
|
||||||
if(args[1].toLowerCase().equals("true"))
|
|
||||||
{
|
|
||||||
config.removeBattleIgnoringPlayer(target.getEntityId());
|
|
||||||
if(senderPlayer != null)
|
|
||||||
{
|
|
||||||
TurnBasedMinecraftMod.NWINSTANCE.sendTo(new PacketGeneralMessage(senderPlayer.getName() + " enabled turn-based-combat for you"), target);
|
|
||||||
TurnBasedMinecraftMod.NWINSTANCE.sendTo(new PacketGeneralMessage("You enabled turn-based-combat for " + target.getName()), senderPlayer);
|
|
||||||
TurnBasedMinecraftMod.logger.info(senderPlayer.getName() + " enabled turn-based-combat for " + target.getName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TurnBasedMinecraftMod.NWINSTANCE.sendTo(new PacketGeneralMessage("An admin enabled turn-based-combat for you"), target);
|
|
||||||
TurnBasedMinecraftMod.logger.info("Enabled turn-based-combat for " + target.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(args[1].toLowerCase().equals("false"))
|
|
||||||
{
|
|
||||||
config.addBattleIgnoringPlayer(target.getEntityId());
|
|
||||||
if(senderPlayer != null)
|
|
||||||
{
|
|
||||||
TurnBasedMinecraftMod.NWINSTANCE.sendTo(new PacketGeneralMessage(senderPlayer.getName() + " disabled turn-based-combat for you"), target);
|
|
||||||
TurnBasedMinecraftMod.NWINSTANCE.sendTo(new PacketGeneralMessage("You disabled turn-based-combat for " + target.getName()), senderPlayer);
|
|
||||||
TurnBasedMinecraftMod.logger.info(senderPlayer.getName() + " disabled turn-based-combat for " + target.getName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TurnBasedMinecraftMod.NWINSTANCE.sendTo(new PacketGeneralMessage("An admin disabled turn-based-combat for you"), target);
|
|
||||||
TurnBasedMinecraftMod.logger.info("Disabled turn-based-combat for " + target.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new WrongUsageException(usage, new Object[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRequiredPermissionLevel()
|
|
||||||
{
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isUsernameIndex(String[] args, int index)
|
|
||||||
{
|
|
||||||
return index == 0;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,7 +2,11 @@ package com.seodisparate.TurnBasedMinecraft.common;
|
||||||
|
|
||||||
import com.seodisparate.TurnBasedMinecraft.client.ClientProxy;
|
import com.seodisparate.TurnBasedMinecraft.client.ClientProxy;
|
||||||
import com.seodisparate.TurnBasedMinecraft.common.networking.*;
|
import com.seodisparate.TurnBasedMinecraft.common.networking.*;
|
||||||
|
import net.minecraft.command.Commands;
|
||||||
|
import net.minecraft.command.arguments.EntityArgument;
|
||||||
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
@ -13,6 +17,7 @@ import net.minecraftforge.fml.event.lifecycle.FMLDedicatedServerSetupEvent;
|
||||||
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
|
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
|
||||||
import net.minecraftforge.fml.event.server.FMLServerStoppingEvent;
|
import net.minecraftforge.fml.event.server.FMLServerStoppingEvent;
|
||||||
import net.minecraftforge.fml.network.NetworkRegistry;
|
import net.minecraftforge.fml.network.NetworkRegistry;
|
||||||
|
import net.minecraftforge.fml.network.PacketDistributor;
|
||||||
import net.minecraftforge.fml.network.simple.SimpleChannel;
|
import net.minecraftforge.fml.network.simple.SimpleChannel;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
@ -128,11 +133,77 @@ public class TurnBasedMinecraftMod
|
||||||
proxy.getConfig().clearBattleIgnoringPlayers();
|
proxy.getConfig().clearBattleIgnoringPlayers();
|
||||||
|
|
||||||
// register commands
|
// register commands
|
||||||
event.registerServerCommand(new CommandTBMDisable(proxy.getConfig()));
|
// tbm-disable
|
||||||
event.registerServerCommand(new CommandTBMEnable(proxy.getConfig()));
|
event.getServer().getCommandManager().getDispatcher().register(
|
||||||
event.registerServerCommand(new CommandTBMSet(proxy.getConfig()));
|
Commands.literal("tbm-disable")
|
||||||
event.registerServerCommand(new CommandTBMDisableAll(proxy.getConfig()));
|
.requires(c -> {
|
||||||
event.registerServerCommand(new CommandTBMEnableAll(proxy.getConfig()));
|
return !proxy.getConfig().getIfOnlyOPsCanDisableTurnBasedForSelf() || c.hasPermissionLevel(2);
|
||||||
|
})
|
||||||
|
.executes( c -> {
|
||||||
|
proxy.getConfig().addBattleIgnoringPlayer(c.getSource().asPlayer().getEntityId());
|
||||||
|
c.getSource().sendFeedback(new StringTextComponent("Disabled turn-based-combat for current player"), true);
|
||||||
|
return 1;
|
||||||
|
}));
|
||||||
|
// tbm-disable-all
|
||||||
|
event.getServer().getCommandManager().getDispatcher().register(
|
||||||
|
Commands.literal("tbm-disable-all")
|
||||||
|
.requires(c -> {
|
||||||
|
return c.hasPermissionLevel(2);
|
||||||
|
})
|
||||||
|
.executes(c -> {
|
||||||
|
proxy.getConfig().setBattleDisabledForAll(true);
|
||||||
|
for(ServerPlayerEntity player : c.getSource().getServer().getPlayerList().getPlayers()) {
|
||||||
|
proxy.getConfig().addBattleIgnoringPlayer(player.getEntityId());
|
||||||
|
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketGeneralMessage("OP disabled turn-based-combat for everyone"));
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}));
|
||||||
|
// tbm-enable
|
||||||
|
event.getServer().getCommandManager().getDispatcher().register(
|
||||||
|
Commands.literal("tbm-enable")
|
||||||
|
.requires(c -> !proxy.getConfig().getIfOnlyOPsCanDisableTurnBasedForSelf() || c.hasPermissionLevel(2))
|
||||||
|
.executes(c -> {
|
||||||
|
proxy.getConfig().removeBattleIgnoringPlayer(c.getSource().asPlayer().getEntityId());
|
||||||
|
c.getSource().sendFeedback(new StringTextComponent("Enabled turn-based-combat for current player"), true));
|
||||||
|
return 1;
|
||||||
|
}));
|
||||||
|
// tbm-enable-all
|
||||||
|
event.getServer().getCommandManager().getDispatcher().register(
|
||||||
|
Commands.literal("tbm-enable-all")
|
||||||
|
.requires(c -> c.hasPermissionLevel(2))
|
||||||
|
.executes(c -> {
|
||||||
|
proxy.getConfig().setBattleDisabledForAll(false);
|
||||||
|
proxy.getConfig().clearBattleIgnoringPlayers();
|
||||||
|
for(ServerPlayerEntity player: c.getSource().getServer().getPlayerList().getPlayers()) {
|
||||||
|
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketGeneralMessage("OP enabled turn-based-combat for everyone"));
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}));
|
||||||
|
// tbm-set-enable
|
||||||
|
event.getServer().getCommandManager().getDispatcher().register(
|
||||||
|
Commands.literal("tbm-set-enable")
|
||||||
|
.requires(c -> c.hasPermissionLevel(2))
|
||||||
|
.then(Commands.argument("targets", EntityArgument.players()).executes(c -> {
|
||||||
|
for(ServerPlayerEntity player : EntityArgument.getPlayers(c, "targets")) {
|
||||||
|
proxy.getConfig().addBattleIgnoringPlayer(player.getEntityId());
|
||||||
|
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketGeneralMessage("OP enabled turn-based-combat for you"));
|
||||||
|
c.getSource().sendFeedback(new StringTextComponent("Enabled turn-based-combat for " + player.getDisplayName().getUnformattedComponentText()), true);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
})));
|
||||||
|
// tbm-set-disable
|
||||||
|
event.getServer().getCommandManager().getDispatcher().register(
|
||||||
|
Commands.literal("tbm-set-disable")
|
||||||
|
.requires(c -> c.hasPermissionLevel(2))
|
||||||
|
.then(Commands.argument("targets", EntityArgument.players()).executes(c -> {
|
||||||
|
for(ServerPlayerEntity player : EntityArgument.getPlayers(c, "targets")) {
|
||||||
|
proxy.getConfig().removeBattleIgnoringPlayer(player.getEntityId());
|
||||||
|
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketGeneralMessage("OP disabled turn-based-combat for you"));
|
||||||
|
c.getSource().sendFeedback(new StringTextComponent("Disabled turn-based-combat for " + player.getDisplayName().getUnformattedComponentText()), true);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
})));
|
||||||
|
// tbm-edit
|
||||||
event.registerServerCommand(new CommandTBMEdit(proxy.getConfig()));
|
event.registerServerCommand(new CommandTBMEdit(proxy.getConfig()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue