mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-26 17:05:01 +00:00
Read the commit description
- Admin chat formats now use MiniMessage - Tab header and footers now use MiniMessage - Certain titles from the plugin now use MiniMessage - More commands now use MiniMessage
This commit is contained in:
parent
733f668145
commit
ccf572315f
@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -19,12 +20,12 @@ public class Command_adventure extends FreedomCommand
|
||||
{
|
||||
if (isConsole())
|
||||
{
|
||||
msg("When used from the console, you must define a target player.");
|
||||
msgNew("When used from the console, you must define a target player.");
|
||||
return true;
|
||||
}
|
||||
|
||||
playerSender.setGameMode(GameMode.ADVENTURE);
|
||||
msg("Your gamemode has been set to adventure.");
|
||||
msgNew("Your gamemode has been set to adventure.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -32,13 +33,14 @@ public class Command_adventure extends FreedomCommand
|
||||
|
||||
if (args[0].equals("-a"))
|
||||
{
|
||||
for (Player targetPlayer : server.getOnlinePlayers())
|
||||
{
|
||||
targetPlayer.setGameMode(GameMode.ADVENTURE);
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Changing everyone's gamemode to adventure", false);
|
||||
msg("Your gamemode has been set to adventure.");
|
||||
|
||||
server.getOnlinePlayers().forEach(player ->
|
||||
{
|
||||
player.setGameMode(GameMode.ADVENTURE);
|
||||
msgNew("Your gamemode has been set to adventure.");
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -50,9 +52,10 @@ public class Command_adventure extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
msg("Setting " + player.getName() + " to game mode adventure.");
|
||||
msg(player, sender.getName() + " set your game mode to adventure.");
|
||||
msgNew("Setting <player> to game mode adventure.", Placeholder.unparsed("player", player.getName()));
|
||||
player.setGameMode(GameMode.ADVENTURE);
|
||||
msgNew(player, "<sender> set your game mode to adventure.", Placeholder.unparsed("sender", sender.getName()));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -17,7 +18,7 @@ public class Command_cleanchat extends FreedomCommand
|
||||
{
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
msg(player, "");
|
||||
msg(player, Component.empty());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -112,7 +112,7 @@ public class Command_mbconfig extends FreedomCommand
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
msg(PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
msg(PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,12 @@ import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FConverter;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@ -17,7 +22,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(rank = Rank.ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Manage your admin entry.", usage = "/<command> [-o <admin name>] <clearips | clearip <ip> | setscformat <format> | clearscformat> | syncroles>")
|
||||
@CommandParameters(description = "Manage your admin entry.", usage = "/<command> [-o <admin name>] <clearips | clearip <ip> | convertacformat | setacformat <format> | clearacformat> | syncroles>")
|
||||
public class Command_myadmin extends FreedomCommand
|
||||
{
|
||||
@Override
|
||||
@ -40,14 +45,14 @@ public class Command_myadmin extends FreedomCommand
|
||||
targetPlayer = getPlayer(args[1]);
|
||||
if (targetPlayer == null)
|
||||
{
|
||||
msg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
msg(PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
target = getAdmin(targetPlayer);
|
||||
if (target == null)
|
||||
{
|
||||
msg("That player is not an admin", ChatColor.RED);
|
||||
msgNew("<red>That player is not an admin");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -86,8 +91,8 @@ public class Command_myadmin extends FreedomCommand
|
||||
plugin.al.updateTables();
|
||||
plugin.pl.syncIps(target);
|
||||
|
||||
msg(counter + " IPs removed.");
|
||||
msg(targetPlayer, target.getIps().get(0) + " is now your only IP address");
|
||||
msgNew("<count> IPs removed.", Placeholder.unparsed("count", String.valueOf(counter)));
|
||||
msgNew(targetPlayer, "<ip> is now your only IP address.", Placeholder.unparsed("ip", String.valueOf(target.getIps().get(0))));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -102,10 +107,11 @@ public class Command_myadmin extends FreedomCommand
|
||||
{
|
||||
if (init == null)
|
||||
{
|
||||
msg("That IP is not registered to you.");
|
||||
} else
|
||||
msgNew("<red>That IP is not registered to you.");
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("That IP does not belong to that player.");
|
||||
msgNew("<red>That IP does not belong to that player.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -114,10 +120,11 @@ public class Command_myadmin extends FreedomCommand
|
||||
{
|
||||
if (init == null)
|
||||
{
|
||||
msg("You cannot remove your current IP.");
|
||||
} else
|
||||
msgNew("<red>You cannot remove your current IP.");
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("You cannot remove that admins current IP.");
|
||||
msgNew("<red>You cannot remove that admin's current IP.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -130,8 +137,26 @@ public class Command_myadmin extends FreedomCommand
|
||||
|
||||
plugin.pl.syncIps(target);
|
||||
|
||||
msg("Removed IP " + args[1]);
|
||||
msg("Current IPs: " + StringUtils.join(target.getIps(), ", "));
|
||||
msgNew("Removed the IP <ip>.", Placeholder.unparsed("ip", args[1]));
|
||||
msgNew("Current IPs: <ips>", Placeholder.unparsed("ip", StringUtils.join(target.getIps(), ", ")));
|
||||
return true;
|
||||
}
|
||||
|
||||
case "convertacformat":
|
||||
{
|
||||
if (!FConverter.needsConversion(target.getAcFormat()))
|
||||
{
|
||||
msgNew("<red>That format does not need to be converted.");
|
||||
}
|
||||
else
|
||||
{
|
||||
msgNew("<yellow>Converting format...");
|
||||
target.setAcFormat(FConverter.convertAdminChatFormat(target.getAcFormat()));
|
||||
plugin.al.save(target);
|
||||
plugin.al.updateTables();
|
||||
msgNew("<green>Format conversion complete.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -139,12 +164,21 @@ public class Command_myadmin extends FreedomCommand
|
||||
case "setscformat":
|
||||
{
|
||||
String format = StringUtils.join(args, " ", 1, args.length);
|
||||
if (FConverter.needsConversion(format))
|
||||
{
|
||||
msgNew("<yellow>⚠ Admin chat formats use MiniMessage now. We'll convert your format for you, but consider using MiniMessage next time: https://docs.advntr.dev/minimessage/format.html ⚠");
|
||||
format = FConverter.convertAdminChatFormat(format);
|
||||
}
|
||||
|
||||
target.setAcFormat(format);
|
||||
plugin.al.save(target);
|
||||
plugin.al.updateTables();
|
||||
msg("Set admin chat format to \"" + format + "\".", ChatColor.GRAY);
|
||||
String example = format.replace("%name%", "ExampleAdmin").replace("%rank%", Rank.ADMIN.getAbbr()).replace("%rankcolor%", Rank.ADMIN.getColor().toString()).replace("%msg%", "The quick brown fox jumps over the lazy dog.");
|
||||
msg(ChatColor.GRAY + "Example: " + FUtil.colorize(example));
|
||||
msgNew("Set admin chat format to \"<format>\"", Placeholder.unparsed("format", format));
|
||||
msgNew("Example:");
|
||||
msgNew(format, Placeholder.unparsed("name", "ExampleAdmin"),
|
||||
Placeholder.unparsed("rank", Rank.ADMIN.getAbbr()),
|
||||
TagResolver.resolver("rankcolor", Tag.styling(lol -> lol.color(TextColor.color(Rank.ADMIN.getColor().getColor().getRGB())))),
|
||||
Placeholder.unparsed("message", "The quick brown fox jumped over the lazy dog."));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -154,7 +188,7 @@ public class Command_myadmin extends FreedomCommand
|
||||
target.setAcFormat(null);
|
||||
plugin.al.save(target);
|
||||
plugin.al.updateTables();
|
||||
msg("Cleared admin chat format.", ChatColor.GRAY);
|
||||
msgNew("Cleared admin chat format.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -164,22 +198,23 @@ public class Command_myadmin extends FreedomCommand
|
||||
{
|
||||
if (!ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
|
||||
{
|
||||
msg("Role syncing is not enabled.", ChatColor.RED);
|
||||
msgNew("<red>Role syncing is not enabled.");
|
||||
return true;
|
||||
}
|
||||
PlayerData playerData = plugin.pl.getData(target.getName());
|
||||
if (playerData.getDiscordID() == null)
|
||||
{
|
||||
msg("Please run /linkdiscord first!", ChatColor.RED);
|
||||
msgNew("<red>Please run /linkdiscord first!");
|
||||
return true;
|
||||
}
|
||||
boolean synced = plugin.dc.syncRoles(target, playerData.getDiscordID());
|
||||
if (synced)
|
||||
{
|
||||
msg("Successfully synced your roles.", ChatColor.GREEN);
|
||||
} else
|
||||
msgNew("<green>Successfully synced your roles.");
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("Failed to sync your roles, please check the console.", ChatColor.RED);
|
||||
msgNew("<red>Failed to sync your roles, please check the console.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -30,7 +30,7 @@ public class Command_orbit extends FreedomCommand
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
msg(PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ public class Command_orbit extends FreedomCommand
|
||||
{
|
||||
if (args[1].equalsIgnoreCase("stop"))
|
||||
{
|
||||
msg("Stopped orbiting " + player.getName());
|
||||
msgNew("Stopped orbiting <player>", Placeholder.unparsed("player", player.getName()));
|
||||
playerdata.stopOrbiting();
|
||||
return true;
|
||||
}
|
||||
@ -53,7 +53,7 @@ public class Command_orbit extends FreedomCommand
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
msg(ex.getMessage(), ChatColor.RED);
|
||||
msgNew("<red>" + ex.getMessage());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class Command_potion extends FreedomCommand
|
||||
|
||||
if (target == null)
|
||||
{
|
||||
msg(PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
msg(PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ import me.totalfreedom.totalfreedommod.LoginProcess;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -21,7 +22,7 @@ public class Command_toggle extends FreedomCommand
|
||||
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke [range] [count]",
|
||||
"explosives [radius]", "unsafeenchs", "bells", "armorstands", "masterblocks", "books", "grindstones",
|
||||
"jukeboxes", "spawners", "4chan", "beehives", "respawnanchors", "autotp", "autoclear", "minecarts", "mp44",
|
||||
"landmines", "tossmob", "gravity");
|
||||
"landmines", "tossmob", "gravity", "chat");
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
@ -38,82 +39,28 @@ public class Command_toggle extends FreedomCommand
|
||||
|
||||
switch (args[0].toLowerCase())
|
||||
{
|
||||
case "waterplace":
|
||||
{
|
||||
toggle("Water placement is", ConfigEntry.ALLOW_WATER_PLACE);
|
||||
break;
|
||||
}
|
||||
|
||||
case "frostwalk":
|
||||
{
|
||||
toggle("Frost walker enchantment is", ConfigEntry.ALLOW_FROSTWALKER);
|
||||
break;
|
||||
}
|
||||
|
||||
case "fireplace":
|
||||
{
|
||||
toggle("Fire placement is", ConfigEntry.ALLOW_FIRE_PLACE);
|
||||
break;
|
||||
}
|
||||
|
||||
case "lavaplace":
|
||||
{
|
||||
toggle("Lava placement is", ConfigEntry.ALLOW_LAVA_PLACE);
|
||||
break;
|
||||
}
|
||||
|
||||
case "fluidspread":
|
||||
{
|
||||
toggle("Fluid spread is", ConfigEntry.ALLOW_FLUID_SPREAD);
|
||||
break;
|
||||
}
|
||||
|
||||
case "lavadmg":
|
||||
{
|
||||
toggle("Lava damage is", ConfigEntry.ALLOW_LAVA_DAMAGE);
|
||||
break;
|
||||
}
|
||||
|
||||
case "firespread":
|
||||
case "waterplace" -> toggle("Water placement is", ConfigEntry.ALLOW_WATER_PLACE);
|
||||
case "frostwalk" -> toggle("Frost walker enchantment is", ConfigEntry.ALLOW_FROSTWALKER);
|
||||
case "fireplace" -> toggle("Fire placement is", ConfigEntry.ALLOW_FIRE_PLACE);
|
||||
case "lavaplace" -> toggle("Lava placement is", ConfigEntry.ALLOW_LAVA_PLACE);
|
||||
case "fluidspread" -> toggle("Fluid spread is", ConfigEntry.ALLOW_FLUID_SPREAD);
|
||||
case "lavadmg" -> toggle("Lava damage is", ConfigEntry.ALLOW_LAVA_DAMAGE);
|
||||
case "firespread" ->
|
||||
{
|
||||
toggle("Fire spread is", ConfigEntry.ALLOW_FIRE_SPREAD);
|
||||
plugin.gr.setGameRule(GameRuleHandler.GameRule.DO_FIRE_TICK, ConfigEntry.ALLOW_FIRE_SPREAD.getBoolean());
|
||||
break;
|
||||
}
|
||||
|
||||
case "prelog":
|
||||
{
|
||||
toggle("Command prelogging is", ConfigEntry.ENABLE_PREPROCESS_LOG);
|
||||
break;
|
||||
}
|
||||
|
||||
case "lockdown":
|
||||
case "prelog" -> toggle("Command prelogging is", ConfigEntry.ENABLE_PREPROCESS_LOG);
|
||||
case "lockdown" ->
|
||||
{
|
||||
boolean active = !LoginProcess.isLockdownEnabled();
|
||||
LoginProcess.setLockdownEnabled(active);
|
||||
FUtil.adminAction(sender.getName(), (active ? "A" : "De-a") + "ctivating server lockdown", true);
|
||||
break;
|
||||
}
|
||||
|
||||
case "petprotect":
|
||||
{
|
||||
toggle("Tamed pet protection is", ConfigEntry.ENABLE_PET_PROTECT);
|
||||
break;
|
||||
}
|
||||
|
||||
case "entitywipe":
|
||||
{
|
||||
toggle("Automatic entity wiping is", ConfigEntry.AUTO_ENTITY_WIPE);
|
||||
break;
|
||||
}
|
||||
|
||||
case "firework":
|
||||
{
|
||||
toggle("Firework explosion is", ConfigEntry.ALLOW_FIREWORK_EXPLOSION);
|
||||
break;
|
||||
}
|
||||
|
||||
case "nonuke":
|
||||
case "petprotect" -> toggle("Tamed pet protection is", ConfigEntry.ENABLE_PET_PROTECT);
|
||||
case "entitywipe" -> toggle("Automatic entity wiping is", ConfigEntry.AUTO_ENTITY_WIPE);
|
||||
case "firework" -> toggle("Firework explosion is", ConfigEntry.ALLOW_FIREWORK_EXPLOSION);
|
||||
case "nonuke" ->
|
||||
{
|
||||
if (args.length >= 2)
|
||||
{
|
||||
@ -123,7 +70,7 @@ public class Command_toggle extends FreedomCommand
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
msg("The input provided is not a valid integer.");
|
||||
msg("<red>The input provided is not a valid integer.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -136,7 +83,7 @@ public class Command_toggle extends FreedomCommand
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
msg("The input provided is not a valid integer.");
|
||||
msgNew("<red>The input provided is not a valid integer.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -145,13 +92,11 @@ public class Command_toggle extends FreedomCommand
|
||||
|
||||
if (ConfigEntry.NUKE_MONITOR_ENABLED.getBoolean())
|
||||
{
|
||||
msg("Anti-freecam range is set to " + ConfigEntry.NUKE_MONITOR_RANGE.getDouble() + " blocks.");
|
||||
msg("Block throttle rate is set to " + ConfigEntry.NUKE_MONITOR_COUNT_BREAK.getInteger() + " blocks destroyed per 5 seconds.");
|
||||
msgNew("Anti-freecam range is set to <range> blocks.", Placeholder.unparsed("range", String.valueOf(ConfigEntry.NUKE_MONITOR_RANGE.getDouble())));
|
||||
msgNew("Block throttle rate is set to <count> blocks destroyed per 5 seconds.", Placeholder.unparsed("count", String.valueOf(ConfigEntry.NUKE_MONITOR_COUNT_BREAK.getInteger())));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case "explosives":
|
||||
case "explosives" ->
|
||||
{
|
||||
if (args.length == 2)
|
||||
{
|
||||
@ -161,7 +106,7 @@ public class Command_toggle extends FreedomCommand
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
msg("The input provided is not a valid integer.");
|
||||
msg("<red>The input provided is not a valid integer.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -170,120 +115,29 @@ public class Command_toggle extends FreedomCommand
|
||||
|
||||
if (ConfigEntry.ALLOW_EXPLOSIONS.getBoolean())
|
||||
{
|
||||
msg("Radius set to " + ConfigEntry.EXPLOSIVE_RADIUS.getDouble());
|
||||
msgNew("Radius set to <radius>.", Placeholder.unparsed("radius", String.valueOf(ConfigEntry.EXPLOSIVE_RADIUS.getDouble())));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case "unsafeenchs":
|
||||
{
|
||||
toggle("Unsafe enchantments are", ConfigEntry.ALLOW_UNSAFE_ENCHANTMENTS);
|
||||
break;
|
||||
}
|
||||
|
||||
case "bells":
|
||||
{
|
||||
toggle("The ringing of bells is", ConfigEntry.ALLOW_BELLS);
|
||||
break;
|
||||
}
|
||||
|
||||
case "armorstands":
|
||||
{
|
||||
toggle("The placement of armor stands is", ConfigEntry.ALLOW_ARMOR_STANDS);
|
||||
break;
|
||||
}
|
||||
|
||||
case "masterblocks":
|
||||
{
|
||||
toggle("Master blocks are", ConfigEntry.ALLOW_MASTERBLOCKS);
|
||||
break;
|
||||
}
|
||||
|
||||
case "books":
|
||||
{
|
||||
toggle("Books are", ConfigEntry.ALLOW_BOOKS);
|
||||
break;
|
||||
}
|
||||
|
||||
case "grindstones":
|
||||
{
|
||||
toggle("Grindstones are", ConfigEntry.ALLOW_GRINDSTONES);
|
||||
break;
|
||||
}
|
||||
|
||||
case "jukeboxes":
|
||||
{
|
||||
toggle("Jukeboxes are", ConfigEntry.ALLOW_JUKEBOXES);
|
||||
break;
|
||||
}
|
||||
|
||||
case "spawners":
|
||||
{
|
||||
toggle("Spawners are", ConfigEntry.ALLOW_SPAWNERS);
|
||||
break;
|
||||
}
|
||||
|
||||
case "4chan":
|
||||
{
|
||||
toggle("4chan mode is", ConfigEntry.FOURCHAN_ENABLED);
|
||||
break;
|
||||
}
|
||||
|
||||
case "beehives":
|
||||
{
|
||||
toggle("Beehives are", ConfigEntry.ALLOW_BEEHIVES);
|
||||
break;
|
||||
}
|
||||
|
||||
case "respawnanchors":
|
||||
{
|
||||
toggle("Respawn anchors are", ConfigEntry.ALLOW_RESPAWN_ANCHORS);
|
||||
break;
|
||||
}
|
||||
|
||||
case "autotp":
|
||||
{
|
||||
toggle("Teleportation on join is", ConfigEntry.AUTO_TP);
|
||||
break;
|
||||
}
|
||||
|
||||
case "autoclear":
|
||||
{
|
||||
toggle("Clearing inventories on join is", ConfigEntry.AUTO_CLEAR);
|
||||
break;
|
||||
}
|
||||
|
||||
case "minecarts":
|
||||
{
|
||||
toggle("Minecarts are", ConfigEntry.ALLOW_MINECARTS);
|
||||
break;
|
||||
}
|
||||
|
||||
case "landmines":
|
||||
{
|
||||
toggle("Landmines are", ConfigEntry.LANDMINES_ENABLED);
|
||||
break;
|
||||
}
|
||||
|
||||
case "mp44":
|
||||
{
|
||||
toggle("MP44 is", ConfigEntry.MP44_ENABLED);
|
||||
break;
|
||||
}
|
||||
|
||||
case "tossmob":
|
||||
{
|
||||
toggle("Tossmob is", ConfigEntry.TOSSMOB_ENABLED);
|
||||
break;
|
||||
}
|
||||
|
||||
case "gravity":
|
||||
{
|
||||
toggle("Block gravity is", ConfigEntry.ALLOW_GRAVITY);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
case "unsafeenchs" -> toggle("Unsafe enchantments are", ConfigEntry.ALLOW_UNSAFE_ENCHANTMENTS);
|
||||
case "bells" -> toggle("The ringing of bells is", ConfigEntry.ALLOW_BELLS);
|
||||
case "armorstands" -> toggle("The placement of armor stands is", ConfigEntry.ALLOW_ARMOR_STANDS);
|
||||
case "masterblocks" -> toggle("Master blocks are", ConfigEntry.ALLOW_MASTERBLOCKS);
|
||||
case "books" -> toggle("Books are", ConfigEntry.ALLOW_BOOKS);
|
||||
case "grindstones" -> toggle("Grindstones are", ConfigEntry.ALLOW_GRINDSTONES);
|
||||
case "jukeboxes" -> toggle("Jukeboxes are", ConfigEntry.ALLOW_JUKEBOXES);
|
||||
case "spawners" -> toggle("Spawners are", ConfigEntry.ALLOW_SPAWNERS);
|
||||
case "4chan" -> toggle("4chan mode is", ConfigEntry.FOURCHAN_ENABLED);
|
||||
case "beehives" -> toggle("Beehives are", ConfigEntry.ALLOW_BEEHIVES);
|
||||
case "respawnanchors" -> toggle("Respawn anchors are", ConfigEntry.ALLOW_RESPAWN_ANCHORS);
|
||||
case "autotp" -> toggle("Teleportation on join is", ConfigEntry.AUTO_TP);
|
||||
case "autoclear" -> toggle("Clearing inventories on join is", ConfigEntry.AUTO_CLEAR);
|
||||
case "minecarts" -> toggle("Minecarts are", ConfigEntry.ALLOW_MINECARTS);
|
||||
case "landmines" -> toggle("Landmines are", ConfigEntry.LANDMINES_ENABLED);
|
||||
case "mp44" -> toggle("MP44 is", ConfigEntry.MP44_ENABLED);
|
||||
case "tossmob" -> toggle("Tossmob is", ConfigEntry.TOSSMOB_ENABLED);
|
||||
case "gravity" -> toggle("Block gravity is", ConfigEntry.ALLOW_GRAVITY);
|
||||
case "chat" -> toggle("Chat is", ConfigEntry.TOGGLE_CHAT);
|
||||
default ->
|
||||
{
|
||||
msg("Available toggles: ");
|
||||
for (String toggle : toggles)
|
||||
@ -315,7 +169,7 @@ public class Command_toggle extends FreedomCommand
|
||||
"waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk",
|
||||
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke", "explosives", "unsafeenchs",
|
||||
"bells", "armorstands", "structureblocks", "jigsaws", "grindstones", "jukeboxes", "spawners", "4chan", "beehives",
|
||||
"respawnanchors", "autotp", "autoclear", "minecarts", "mp44", "landmines", "tossmob", "gravity");
|
||||
"respawnanchors", "autotp", "autoclear", "minecarts", "mp44", "landmines", "tossmob", "gravity", "chat");
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(rank = Rank.ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Toggle online players' ability to chat.", usage = "/<command>", aliases = "tc")
|
||||
public class Command_togglechat extends FreedomCommand
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
ConfigEntry.TOGGLE_CHAT.setBoolean(!ConfigEntry.TOGGLE_CHAT.getBoolean());
|
||||
FUtil.adminAction(sender.getName(), "Chat " + (ConfigEntry.TOGGLE_CHAT.getBoolean() ? "enabled" : "disabled") + ".", true);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -21,7 +21,7 @@ public class Command_tprandom extends FreedomCommand
|
||||
int y = playerSender.getWorld().getHighestBlockYAt(x, z) + 1;
|
||||
Location location = new Location(playerSender.getLocation().getWorld(), x, y, z);
|
||||
PaperLib.teleportAsync(playerSender, location);
|
||||
msg("Poof!", ChatColor.GREEN);
|
||||
msgNew("<green>Poof!");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.api.ShopItem;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -15,26 +16,27 @@ public class Command_trail extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (plugin.sh == null) {
|
||||
msg("Shop is not enabled.", ChatColor.RED);
|
||||
if (plugin.sh == null)
|
||||
{
|
||||
msgNew("<red>Shop is not enabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!plugin.pl.getData(playerSender).hasItem(ShopItem.RAINBOW_TRAIL))
|
||||
{
|
||||
msg("You didn't purchase the ability to have a " + ShopItem.RAINBOW_TRAIL.getName() + "! Purchase it from the shop.", ChatColor.RED);
|
||||
msgNew("<red>You didn't purchase the ability to have a <item>! Purchase it from the shop.",Placeholder.unparsed("item", ShopItem.RAINBOW_TRAIL.getName()));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (plugin.tr.contains(playerSender))
|
||||
{
|
||||
plugin.tr.remove(playerSender);
|
||||
msg("Trail disabled.");
|
||||
msgNew("Trail disabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.tr.add(playerSender);
|
||||
msg("Trail enabled. Run this command again to disable it.");
|
||||
msgNew("Trail enabled. Run this command again to disable it.");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -160,11 +160,6 @@ public abstract class FreedomCommand implements CommandExecutor, TabCompleter
|
||||
msg(color + message);
|
||||
}
|
||||
|
||||
protected void msg(String message, net.md_5.bungee.api.ChatColor color)
|
||||
{
|
||||
msg(color + message);
|
||||
}
|
||||
|
||||
protected boolean isAdmin(Player player)
|
||||
{
|
||||
return plugin.al.isAdmin(player);
|
||||
|
@ -0,0 +1,2 @@
|
||||
package me.totalfreedom.totalfreedommod.util;public class FConverter {
|
||||
}
|
Loading…
Reference in New Issue
Block a user