mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-01 05:57:09 +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.rank.Rank;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -19,12 +20,12 @@ public class Command_adventure extends FreedomCommand
|
|||||||
{
|
{
|
||||||
if (isConsole())
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
playerSender.setGameMode(GameMode.ADVENTURE);
|
playerSender.setGameMode(GameMode.ADVENTURE);
|
||||||
msg("Your gamemode has been set to adventure.");
|
msgNew("Your gamemode has been set to adventure.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,13 +33,14 @@ public class Command_adventure extends FreedomCommand
|
|||||||
|
|
||||||
if (args[0].equals("-a"))
|
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);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,9 +52,10 @@ public class Command_adventure extends FreedomCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg("Setting " + player.getName() + " to game mode adventure.");
|
msgNew("Setting <player> to game mode adventure.", Placeholder.unparsed("player", player.getName()));
|
||||||
msg(player, sender.getName() + " set your game mode to adventure.");
|
|
||||||
player.setGameMode(GameMode.ADVENTURE);
|
player.setGameMode(GameMode.ADVENTURE);
|
||||||
|
msgNew(player, "<sender> set your game mode to adventure.", Placeholder.unparsed("sender", sender.getName()));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod.command;
|
|||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -17,7 +18,7 @@ public class Command_cleanchat extends FreedomCommand
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < 100; i++)
|
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)
|
if (data == null)
|
||||||
{
|
{
|
||||||
msg(PLAYER_NOT_FOUND, ChatColor.RED);
|
msg(PLAYER_NOT_FOUND);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,12 @@ import me.totalfreedom.totalfreedommod.admin.Admin;
|
|||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
|
import me.totalfreedom.totalfreedommod.util.FConverter;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
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.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -17,7 +22,7 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@CommandPermissions(rank = Rank.ADMIN, source = SourceType.ONLY_IN_GAME)
|
@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
|
public class Command_myadmin extends FreedomCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -40,14 +45,14 @@ public class Command_myadmin extends FreedomCommand
|
|||||||
targetPlayer = getPlayer(args[1]);
|
targetPlayer = getPlayer(args[1]);
|
||||||
if (targetPlayer == null)
|
if (targetPlayer == null)
|
||||||
{
|
{
|
||||||
msg(FreedomCommand.PLAYER_NOT_FOUND);
|
msg(PLAYER_NOT_FOUND);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
target = getAdmin(targetPlayer);
|
target = getAdmin(targetPlayer);
|
||||||
if (target == null)
|
if (target == null)
|
||||||
{
|
{
|
||||||
msg("That player is not an admin", ChatColor.RED);
|
msgNew("<red>That player is not an admin");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,8 +91,8 @@ public class Command_myadmin extends FreedomCommand
|
|||||||
plugin.al.updateTables();
|
plugin.al.updateTables();
|
||||||
plugin.pl.syncIps(target);
|
plugin.pl.syncIps(target);
|
||||||
|
|
||||||
msg(counter + " IPs removed.");
|
msgNew("<count> IPs removed.", Placeholder.unparsed("count", String.valueOf(counter)));
|
||||||
msg(targetPlayer, target.getIps().get(0) + " is now your only IP address");
|
msgNew(targetPlayer, "<ip> is now your only IP address.", Placeholder.unparsed("ip", String.valueOf(target.getIps().get(0))));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,10 +107,11 @@ public class Command_myadmin extends FreedomCommand
|
|||||||
{
|
{
|
||||||
if (init == null)
|
if (init == null)
|
||||||
{
|
{
|
||||||
msg("That IP is not registered to you.");
|
msgNew("<red>That IP is not registered to you.");
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
msg("That IP does not belong to that player.");
|
msgNew("<red>That IP does not belong to that player.");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -114,10 +120,11 @@ public class Command_myadmin extends FreedomCommand
|
|||||||
{
|
{
|
||||||
if (init == null)
|
if (init == null)
|
||||||
{
|
{
|
||||||
msg("You cannot remove your current IP.");
|
msgNew("<red>You cannot remove your current IP.");
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
msg("You cannot remove that admins current IP.");
|
msgNew("<red>You cannot remove that admin's current IP.");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -130,8 +137,26 @@ public class Command_myadmin extends FreedomCommand
|
|||||||
|
|
||||||
plugin.pl.syncIps(target);
|
plugin.pl.syncIps(target);
|
||||||
|
|
||||||
msg("Removed IP " + args[1]);
|
msgNew("Removed the IP <ip>.", Placeholder.unparsed("ip", args[1]));
|
||||||
msg("Current IPs: " + StringUtils.join(target.getIps(), ", "));
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,12 +164,21 @@ public class Command_myadmin extends FreedomCommand
|
|||||||
case "setscformat":
|
case "setscformat":
|
||||||
{
|
{
|
||||||
String format = StringUtils.join(args, " ", 1, args.length);
|
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);
|
target.setAcFormat(format);
|
||||||
plugin.al.save(target);
|
plugin.al.save(target);
|
||||||
plugin.al.updateTables();
|
plugin.al.updateTables();
|
||||||
msg("Set admin chat format to \"" + format + "\".", ChatColor.GRAY);
|
msgNew("Set admin chat format to \"<format>\"", Placeholder.unparsed("format", format));
|
||||||
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.");
|
msgNew("Example:");
|
||||||
msg(ChatColor.GRAY + "Example: " + FUtil.colorize(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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +188,7 @@ public class Command_myadmin extends FreedomCommand
|
|||||||
target.setAcFormat(null);
|
target.setAcFormat(null);
|
||||||
plugin.al.save(target);
|
plugin.al.save(target);
|
||||||
plugin.al.updateTables();
|
plugin.al.updateTables();
|
||||||
msg("Cleared admin chat format.", ChatColor.GRAY);
|
msgNew("Cleared admin chat format.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,22 +198,23 @@ public class Command_myadmin extends FreedomCommand
|
|||||||
{
|
{
|
||||||
if (!ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
|
if (!ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
|
||||||
{
|
{
|
||||||
msg("Role syncing is not enabled.", ChatColor.RED);
|
msgNew("<red>Role syncing is not enabled.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
PlayerData playerData = plugin.pl.getData(target.getName());
|
PlayerData playerData = plugin.pl.getData(target.getName());
|
||||||
if (playerData.getDiscordID() == null)
|
if (playerData.getDiscordID() == null)
|
||||||
{
|
{
|
||||||
msg("Please run /linkdiscord first!", ChatColor.RED);
|
msgNew("<red>Please run /linkdiscord first!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
boolean synced = plugin.dc.syncRoles(target, playerData.getDiscordID());
|
boolean synced = plugin.dc.syncRoles(target, playerData.getDiscordID());
|
||||||
if (synced)
|
if (synced)
|
||||||
{
|
{
|
||||||
msg("Successfully synced your roles.", ChatColor.GREEN);
|
msgNew("<green>Successfully synced your roles.");
|
||||||
} else
|
}
|
||||||
|
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.punishments.PunishmentType;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
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.GameMode;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -30,7 +30,7 @@ public class Command_orbit extends FreedomCommand
|
|||||||
|
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
msg(PLAYER_NOT_FOUND);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ public class Command_orbit extends FreedomCommand
|
|||||||
{
|
{
|
||||||
if (args[1].equalsIgnoreCase("stop"))
|
if (args[1].equalsIgnoreCase("stop"))
|
||||||
{
|
{
|
||||||
msg("Stopped orbiting " + player.getName());
|
msgNew("Stopped orbiting <player>", Placeholder.unparsed("player", player.getName()));
|
||||||
playerdata.stopOrbiting();
|
playerdata.stopOrbiting();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ public class Command_orbit extends FreedomCommand
|
|||||||
}
|
}
|
||||||
catch (NumberFormatException ex)
|
catch (NumberFormatException ex)
|
||||||
{
|
{
|
||||||
msg(ex.getMessage(), ChatColor.RED);
|
msgNew("<red>" + ex.getMessage());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ public class Command_potion extends FreedomCommand
|
|||||||
|
|
||||||
if (target == null)
|
if (target == null)
|
||||||
{
|
{
|
||||||
msg(PLAYER_NOT_FOUND, ChatColor.RED);
|
msg(PLAYER_NOT_FOUND);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import me.totalfreedom.totalfreedommod.LoginProcess;
|
|||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -21,7 +22,7 @@ public class Command_toggle extends FreedomCommand
|
|||||||
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke [range] [count]",
|
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke [range] [count]",
|
||||||
"explosives [radius]", "unsafeenchs", "bells", "armorstands", "masterblocks", "books", "grindstones",
|
"explosives [radius]", "unsafeenchs", "bells", "armorstands", "masterblocks", "books", "grindstones",
|
||||||
"jukeboxes", "spawners", "4chan", "beehives", "respawnanchors", "autotp", "autoclear", "minecarts", "mp44",
|
"jukeboxes", "spawners", "4chan", "beehives", "respawnanchors", "autotp", "autoclear", "minecarts", "mp44",
|
||||||
"landmines", "tossmob", "gravity");
|
"landmines", "tossmob", "gravity", "chat");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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())
|
switch (args[0].toLowerCase())
|
||||||
{
|
{
|
||||||
case "waterplace":
|
case "waterplace" -> toggle("Water placement is", ConfigEntry.ALLOW_WATER_PLACE);
|
||||||
{
|
case "frostwalk" -> toggle("Frost walker enchantment is", ConfigEntry.ALLOW_FROSTWALKER);
|
||||||
toggle("Water placement is", ConfigEntry.ALLOW_WATER_PLACE);
|
case "fireplace" -> toggle("Fire placement is", ConfigEntry.ALLOW_FIRE_PLACE);
|
||||||
break;
|
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 "frostwalk":
|
case "firespread" ->
|
||||||
{
|
|
||||||
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":
|
|
||||||
{
|
{
|
||||||
toggle("Fire spread is", ConfigEntry.ALLOW_FIRE_SPREAD);
|
toggle("Fire spread is", ConfigEntry.ALLOW_FIRE_SPREAD);
|
||||||
plugin.gr.setGameRule(GameRuleHandler.GameRule.DO_FIRE_TICK, ConfigEntry.ALLOW_FIRE_SPREAD.getBoolean());
|
plugin.gr.setGameRule(GameRuleHandler.GameRule.DO_FIRE_TICK, ConfigEntry.ALLOW_FIRE_SPREAD.getBoolean());
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
case "prelog" -> toggle("Command prelogging is", ConfigEntry.ENABLE_PREPROCESS_LOG);
|
||||||
case "prelog":
|
case "lockdown" ->
|
||||||
{
|
|
||||||
toggle("Command prelogging is", ConfigEntry.ENABLE_PREPROCESS_LOG);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "lockdown":
|
|
||||||
{
|
{
|
||||||
boolean active = !LoginProcess.isLockdownEnabled();
|
boolean active = !LoginProcess.isLockdownEnabled();
|
||||||
LoginProcess.setLockdownEnabled(active);
|
LoginProcess.setLockdownEnabled(active);
|
||||||
FUtil.adminAction(sender.getName(), (active ? "A" : "De-a") + "ctivating server lockdown", true);
|
FUtil.adminAction(sender.getName(), (active ? "A" : "De-a") + "ctivating server lockdown", true);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
case "petprotect" -> toggle("Tamed pet protection is", ConfigEntry.ENABLE_PET_PROTECT);
|
||||||
case "petprotect":
|
case "entitywipe" -> toggle("Automatic entity wiping is", ConfigEntry.AUTO_ENTITY_WIPE);
|
||||||
{
|
case "firework" -> toggle("Firework explosion is", ConfigEntry.ALLOW_FIREWORK_EXPLOSION);
|
||||||
toggle("Tamed pet protection is", ConfigEntry.ENABLE_PET_PROTECT);
|
case "nonuke" ->
|
||||||
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":
|
|
||||||
{
|
{
|
||||||
if (args.length >= 2)
|
if (args.length >= 2)
|
||||||
{
|
{
|
||||||
@ -123,7 +70,7 @@ public class Command_toggle extends FreedomCommand
|
|||||||
}
|
}
|
||||||
catch (NumberFormatException ex)
|
catch (NumberFormatException ex)
|
||||||
{
|
{
|
||||||
msg("The input provided is not a valid integer.");
|
msg("<red>The input provided is not a valid integer.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,7 +83,7 @@ public class Command_toggle extends FreedomCommand
|
|||||||
}
|
}
|
||||||
catch (NumberFormatException ex)
|
catch (NumberFormatException ex)
|
||||||
{
|
{
|
||||||
msg("The input provided is not a valid integer.");
|
msgNew("<red>The input provided is not a valid integer.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,13 +92,11 @@ public class Command_toggle extends FreedomCommand
|
|||||||
|
|
||||||
if (ConfigEntry.NUKE_MONITOR_ENABLED.getBoolean())
|
if (ConfigEntry.NUKE_MONITOR_ENABLED.getBoolean())
|
||||||
{
|
{
|
||||||
msg("Anti-freecam range is set to " + ConfigEntry.NUKE_MONITOR_RANGE.getDouble() + " blocks.");
|
msgNew("Anti-freecam range is set to <range> blocks.", Placeholder.unparsed("range", String.valueOf(ConfigEntry.NUKE_MONITOR_RANGE.getDouble())));
|
||||||
msg("Block throttle rate is set to " + ConfigEntry.NUKE_MONITOR_COUNT_BREAK.getInteger() + " blocks destroyed per 5 seconds.");
|
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)
|
if (args.length == 2)
|
||||||
{
|
{
|
||||||
@ -161,7 +106,7 @@ public class Command_toggle extends FreedomCommand
|
|||||||
}
|
}
|
||||||
catch (NumberFormatException ex)
|
catch (NumberFormatException ex)
|
||||||
{
|
{
|
||||||
msg("The input provided is not a valid integer.");
|
msg("<red>The input provided is not a valid integer.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -170,120 +115,29 @@ public class Command_toggle extends FreedomCommand
|
|||||||
|
|
||||||
if (ConfigEntry.ALLOW_EXPLOSIONS.getBoolean())
|
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);
|
||||||
case "unsafeenchs":
|
case "bells" -> toggle("The ringing of bells is", ConfigEntry.ALLOW_BELLS);
|
||||||
{
|
case "armorstands" -> toggle("The placement of armor stands is", ConfigEntry.ALLOW_ARMOR_STANDS);
|
||||||
toggle("Unsafe enchantments are", ConfigEntry.ALLOW_UNSAFE_ENCHANTMENTS);
|
case "masterblocks" -> toggle("Master blocks are", ConfigEntry.ALLOW_MASTERBLOCKS);
|
||||||
break;
|
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 "bells":
|
case "spawners" -> toggle("Spawners are", ConfigEntry.ALLOW_SPAWNERS);
|
||||||
{
|
case "4chan" -> toggle("4chan mode is", ConfigEntry.FOURCHAN_ENABLED);
|
||||||
toggle("The ringing of bells is", ConfigEntry.ALLOW_BELLS);
|
case "beehives" -> toggle("Beehives are", ConfigEntry.ALLOW_BEEHIVES);
|
||||||
break;
|
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 "armorstands":
|
case "minecarts" -> toggle("Minecarts are", ConfigEntry.ALLOW_MINECARTS);
|
||||||
{
|
case "landmines" -> toggle("Landmines are", ConfigEntry.LANDMINES_ENABLED);
|
||||||
toggle("The placement of armor stands is", ConfigEntry.ALLOW_ARMOR_STANDS);
|
case "mp44" -> toggle("MP44 is", ConfigEntry.MP44_ENABLED);
|
||||||
break;
|
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);
|
||||||
case "masterblocks":
|
default ->
|
||||||
{
|
|
||||||
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:
|
|
||||||
{
|
{
|
||||||
msg("Available toggles: ");
|
msg("Available toggles: ");
|
||||||
for (String toggle : toggles)
|
for (String toggle : toggles)
|
||||||
@ -315,7 +169,7 @@ public class Command_toggle extends FreedomCommand
|
|||||||
"waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk",
|
"waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk",
|
||||||
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke", "explosives", "unsafeenchs",
|
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke", "explosives", "unsafeenchs",
|
||||||
"bells", "armorstands", "structureblocks", "jigsaws", "grindstones", "jukeboxes", "spawners", "4chan", "beehives",
|
"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();
|
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;
|
int y = playerSender.getWorld().getHighestBlockYAt(x, z) + 1;
|
||||||
Location location = new Location(playerSender.getLocation().getWorld(), x, y, z);
|
Location location = new Location(playerSender.getLocation().getWorld(), x, y, z);
|
||||||
PaperLib.teleportAsync(playerSender, location);
|
PaperLib.teleportAsync(playerSender, location);
|
||||||
msg("Poof!", ChatColor.GREEN);
|
msgNew("<green>Poof!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod.command;
|
|||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import me.totalfreedom.totalfreedommod.api.ShopItem;
|
import me.totalfreedom.totalfreedommod.api.ShopItem;
|
||||||
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -15,26 +16,27 @@ public class Command_trail extends FreedomCommand
|
|||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if (plugin.sh == null) {
|
if (plugin.sh == null)
|
||||||
msg("Shop is not enabled.", ChatColor.RED);
|
{
|
||||||
|
msgNew("<red>Shop is not enabled.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plugin.pl.getData(playerSender).hasItem(ShopItem.RAINBOW_TRAIL))
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin.tr.contains(playerSender))
|
if (plugin.tr.contains(playerSender))
|
||||||
{
|
{
|
||||||
plugin.tr.remove(playerSender);
|
plugin.tr.remove(playerSender);
|
||||||
msg("Trail disabled.");
|
msgNew("Trail disabled.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
plugin.tr.add(playerSender);
|
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;
|
return true;
|
||||||
|
@ -160,11 +160,6 @@ public abstract class FreedomCommand implements CommandExecutor, TabCompleter
|
|||||||
msg(color + message);
|
msg(color + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void msg(String message, net.md_5.bungee.api.ChatColor color)
|
|
||||||
{
|
|
||||||
msg(color + message);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean isAdmin(Player player)
|
protected boolean isAdmin(Player player)
|
||||||
{
|
{
|
||||||
return plugin.al.isAdmin(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