Always use the username of the command target if the command exceeds the maximum chat message length and command blocks need to be used
This commit is contained in:
@@ -76,77 +76,77 @@ public class ActionHelper
|
||||
|
||||
public static void timeDawn()
|
||||
{
|
||||
CommandHelper.sendCommand(new BuilderTime(EnumMode.SET, Config.getSettings().getDawn()));
|
||||
CommandHelper.sendCommand(null, new BuilderTime(EnumMode.SET, Config.getSettings().getDawn()));
|
||||
}
|
||||
|
||||
public static void timeNoon()
|
||||
{
|
||||
CommandHelper.sendCommand(new BuilderTime(EnumMode.SET, Config.getSettings().getNoon()));
|
||||
CommandHelper.sendCommand(null, new BuilderTime(EnumMode.SET, Config.getSettings().getNoon()));
|
||||
}
|
||||
|
||||
public static void timeSunset()
|
||||
{
|
||||
CommandHelper.sendCommand(new BuilderTime(EnumMode.SET, Config.getSettings().getSunset()));
|
||||
CommandHelper.sendCommand(null, new BuilderTime(EnumMode.SET, Config.getSettings().getSunset()));
|
||||
}
|
||||
|
||||
public static void timeMidnight()
|
||||
{
|
||||
CommandHelper.sendCommand(new BuilderTime(EnumMode.SET, Config.getSettings().getMidnight()));
|
||||
CommandHelper.sendCommand(null, new BuilderTime(EnumMode.SET, Config.getSettings().getMidnight()));
|
||||
}
|
||||
|
||||
public static void weatherClear()
|
||||
{
|
||||
CommandHelper.sendCommand(new BuilderWeather(EnumWeather.CLEAR));
|
||||
CommandHelper.sendCommand(null, new BuilderWeather(EnumWeather.CLEAR));
|
||||
}
|
||||
|
||||
public static void weatherRain()
|
||||
{
|
||||
CommandHelper.sendCommand(new BuilderWeather(EnumWeather.RAIN));
|
||||
CommandHelper.sendCommand(null, new BuilderWeather(EnumWeather.RAIN));
|
||||
}
|
||||
|
||||
public static void weatherThunder()
|
||||
{
|
||||
CommandHelper.sendCommand(new BuilderWeather(EnumWeather.THUNDER));
|
||||
CommandHelper.sendCommand(null, new BuilderWeather(EnumWeather.THUNDER));
|
||||
}
|
||||
|
||||
public static void difficultyPeaceful()
|
||||
{
|
||||
CommandHelper.sendCommand(new BuilderDifficulty(Difficulty.PEACEFUL));
|
||||
CommandHelper.sendCommand(null, new BuilderDifficulty(Difficulty.PEACEFUL));
|
||||
}
|
||||
|
||||
public static void difficultyEasy()
|
||||
{
|
||||
CommandHelper.sendCommand(new BuilderDifficulty(Difficulty.EASY));
|
||||
CommandHelper.sendCommand(null, new BuilderDifficulty(Difficulty.EASY));
|
||||
}
|
||||
|
||||
public static void difficultyNormal()
|
||||
{
|
||||
CommandHelper.sendCommand(new BuilderDifficulty(Difficulty.NORMAL));
|
||||
CommandHelper.sendCommand(null, new BuilderDifficulty(Difficulty.NORMAL));
|
||||
}
|
||||
|
||||
public static void difficultyHard()
|
||||
{
|
||||
CommandHelper.sendCommand(new BuilderDifficulty(Difficulty.HARD));
|
||||
CommandHelper.sendCommand(null, new BuilderDifficulty(Difficulty.HARD));
|
||||
}
|
||||
|
||||
public static void gamemodeSurvival()
|
||||
{
|
||||
CommandHelper.sendCommand(new BuilderGamemode(EnumGamemode.SURVIVAL));
|
||||
CommandHelper.sendCommand(null, new BuilderGamemode(EnumGamemode.SURVIVAL));
|
||||
}
|
||||
|
||||
public static void gamemodeCreative()
|
||||
{
|
||||
CommandHelper.sendCommand(new BuilderGamemode(EnumGamemode.CREATIVE));
|
||||
CommandHelper.sendCommand(null, new BuilderGamemode(EnumGamemode.CREATIVE));
|
||||
}
|
||||
|
||||
public static void gamemodeAdventure()
|
||||
{
|
||||
CommandHelper.sendCommand(new BuilderGamemode(EnumGamemode.ADVENTURE));
|
||||
CommandHelper.sendCommand(null, new BuilderGamemode(EnumGamemode.ADVENTURE));
|
||||
}
|
||||
|
||||
public static void gamemodeSpectator()
|
||||
{
|
||||
CommandHelper.sendCommand(new BuilderGamemode(EnumGamemode.SPECTATOR));
|
||||
CommandHelper.sendCommand(null, new BuilderGamemode(EnumGamemode.SPECTATOR));
|
||||
}
|
||||
|
||||
public static void tryRun(ActionHandler action)
|
||||
|
||||
@@ -146,7 +146,7 @@ public class BlockHelper
|
||||
POS_2_OBSERVERS.add(observer);
|
||||
}
|
||||
|
||||
public static boolean setCommandBlockNearPlayer(String command)
|
||||
public static boolean setCommandBlockNearPlayer(String player, String command)
|
||||
{
|
||||
if(CommandHelper.canPlayerIssueCommand() && Minecraft.getInstance().getConnection() != null)
|
||||
{
|
||||
@@ -170,7 +170,7 @@ public class BlockHelper
|
||||
|
||||
BuilderExecute wrapped = new BuilderExecute();
|
||||
wrapped.setMode1(EnumMode.AT);
|
||||
wrapped.setTarget(Minecraft.getInstance().player.getGameProfile().getName());
|
||||
wrapped.setTarget(player);
|
||||
wrapped.setMode2(EnumMode.RUN);
|
||||
wrapped.setCommand(command);
|
||||
|
||||
@@ -183,10 +183,10 @@ public class BlockHelper
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void setBlockNearPlayer(Block block)
|
||||
public static void setBlockNearPlayer(String player, Block block) //TODO usage
|
||||
{
|
||||
BuilderSetBlock builder = new BuilderSetBlock(new CoordinateInt(EnumType.LOCAL), new CoordinateInt(EnumType.LOCAL), new CoordinateInt(2, EnumType.LOCAL), block.getRegistryName(), Config.getSettings().getBlockPlacingMode());
|
||||
builder.setState(BlockStateProperties.HORIZONTAL_FACING, Minecraft.getInstance().player.getHorizontalFacing().getOpposite());
|
||||
CommandHelper.sendCommand(builder);
|
||||
CommandHelper.sendCommand(player, builder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,13 +32,13 @@ public class CommandHelper
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void sendCommand(ICommandBuilder builder)
|
||||
public static void sendCommand(String player, ICommandBuilder builder)
|
||||
{
|
||||
CommandHelper.sendCommand(builder, false);
|
||||
CommandHelper.sendCommand(player, builder, false);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void sendCommand(ICommandBuilder builder, boolean special)
|
||||
public static void sendCommand(String player, ICommandBuilder builder, boolean special)
|
||||
{
|
||||
if(builder != null)
|
||||
{
|
||||
@@ -57,7 +57,7 @@ public class CommandHelper
|
||||
|
||||
if(builder.needsCommandBlock() || special)
|
||||
{
|
||||
BlockHelper.setCommandBlockNearPlayer(command);
|
||||
BlockHelper.setCommandBlockNearPlayer(player, command);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user