mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 17:17:37 +00:00
a few things
This commit is contained in:
parent
e23929ee0c
commit
137bc44212
@ -442,7 +442,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
|
|||||||
*/
|
*/
|
||||||
protected Component usage(String s)
|
protected Component usage(String s)
|
||||||
{
|
{
|
||||||
return componentFromString(ChatColor.YELLOW + "Correct Usage: " + ChatColor.GRAY + this.getUsage());
|
return componentFromString(ChatColor.YELLOW + "Correct Usage: " + ChatColor.GRAY + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Player getNonNullPlayer(String name)
|
protected Player getNonNullPlayer(String name)
|
||||||
|
@ -7,6 +7,7 @@ import dev.plex.command.annotation.CommandParameters;
|
|||||||
import dev.plex.command.annotation.CommandPermissions;
|
import dev.plex.command.annotation.CommandPermissions;
|
||||||
import dev.plex.rank.enums.Rank;
|
import dev.plex.rank.enums.Rank;
|
||||||
import dev.plex.util.PlexUtils;
|
import dev.plex.util.PlexUtils;
|
||||||
|
import java.util.List;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -14,9 +15,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.List;
|
@CommandParameters(name = "debug", description = "Debug command", usage = "/<command> redis-reset [player]")
|
||||||
|
|
||||||
@CommandParameters(name = "debug", description = "Debug command", usage = "/<command> <redis-reset> [player]")
|
|
||||||
@CommandPermissions(level = Rank.EXECUTIVE, permission = "plex.debug")
|
@CommandPermissions(level = Rank.EXECUTIVE, permission = "plex.debug")
|
||||||
public class DebugCMD extends PlexCommand
|
public class DebugCMD extends PlexCommand
|
||||||
{
|
{
|
||||||
@ -30,15 +29,13 @@ public class DebugCMD extends PlexCommand
|
|||||||
if (args[0].equalsIgnoreCase("redis-reset"))
|
if (args[0].equalsIgnoreCase("redis-reset"))
|
||||||
{
|
{
|
||||||
Player player = getNonNullPlayer(args[1]);
|
Player player = getNonNullPlayer(args[1]);
|
||||||
if (Plex.get().getRedisConnection().getJedis().exists(player.getUniqueId().toString()))
|
if (plugin.getRedisConnection().getJedis().exists(player.getUniqueId().toString()))
|
||||||
{
|
{
|
||||||
Plex.get().getRedisConnection().getJedis().del(player.getUniqueId().toString());
|
plugin.getRedisConnection().getJedis().del(player.getUniqueId().toString());
|
||||||
return componentFromString("Successfully reset " + player.getName() + "'s redis punishments!").color(NamedTextColor.YELLOW);
|
return componentFromString("Successfully reset " + player.getName() + "'s Redis punishments!").color(NamedTextColor.YELLOW);
|
||||||
}
|
}
|
||||||
return componentFromString("Couldn't find player in redis punishments.");
|
return componentFromString("Couldn't find player in Redis punishments.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class TagCMD extends PlexCommand
|
|||||||
String prefix = StringUtils.join(args, " ", 1, args.length);
|
String prefix = StringUtils.join(args, " ", 1, args.length);
|
||||||
if (ChatColor.stripColor(prefix).length() > plugin.config.getInt("chat.max-tag-length", 16))
|
if (ChatColor.stripColor(prefix).length() > plugin.config.getInt("chat.max-tag-length", 16))
|
||||||
{
|
{
|
||||||
return componentFromString("The max length for a tag may only be " + plugin.config.getInt("chat.max-tag-length", 16));
|
return componentFromString("The maximum length for a tag may only be " + plugin.config.getInt("chat.max-tag-length", 16));
|
||||||
}
|
}
|
||||||
player.setPrefix(prefix);
|
player.setPrefix(prefix);
|
||||||
return Component.text("Your prefix has been set to ").color(NamedTextColor.AQUA).append(componentFromString(prefix));
|
return Component.text("Your prefix has been set to ").color(NamedTextColor.AQUA).append(componentFromString(prefix));
|
||||||
@ -68,7 +68,7 @@ public class TagCMD extends PlexCommand
|
|||||||
return Component.text("Your prefix has been cleared.").color(NamedTextColor.AQUA);
|
return Component.text("Your prefix has been cleared.").color(NamedTextColor.AQUA);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkRank(sender, Rank.ADMIN, "plex.tag.clearother");
|
checkRank(sender, Rank.ADMIN, "plex.tag.clear.others");
|
||||||
|
|
||||||
Player target = getNonNullPlayer(args[1]);
|
Player target = getNonNullPlayer(args[1]);
|
||||||
PlexPlayer plexTarget = DataUtils.getPlayer(target.getUniqueId());
|
PlexPlayer plexTarget = DataUtils.getPlayer(target.getUniqueId());
|
||||||
|
@ -8,7 +8,11 @@ import dev.plex.cache.SQLPlayerData;
|
|||||||
import dev.plex.listener.PlexListener;
|
import dev.plex.listener.PlexListener;
|
||||||
import dev.plex.player.PlexPlayer;
|
import dev.plex.player.PlexPlayer;
|
||||||
import dev.plex.player.PunishedPlayer;
|
import dev.plex.player.PunishedPlayer;
|
||||||
|
import dev.plex.rank.enums.Title;
|
||||||
import dev.plex.util.PlexLog;
|
import dev.plex.util.PlexLog;
|
||||||
|
import dev.plex.util.PlexUtils;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.UUID;
|
||||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -17,9 +21,6 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class PlayerListener extends PlexListener
|
public class PlayerListener extends PlexListener
|
||||||
{
|
{
|
||||||
private final MongoPlayerData mongoPlayerData = plugin.getMongoPlayerData() != null ? plugin.getMongoPlayerData() : null;
|
private final MongoPlayerData mongoPlayerData = plugin.getMongoPlayerData() != null ? plugin.getMongoPlayerData() : null;
|
||||||
@ -37,7 +38,8 @@ public class PlayerListener extends PlexListener
|
|||||||
{
|
{
|
||||||
player.setOp(true);
|
player.setOp(true);
|
||||||
PlexLog.debug("Automatically opped " + player.getName() + " since ranks are enabled.");
|
PlexLog.debug("Automatically opped " + player.getName() + " since ranks are enabled.");
|
||||||
} else if (plugin.getSystem().equalsIgnoreCase("permissions"))
|
}
|
||||||
|
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
|
||||||
{
|
{
|
||||||
player.setOp(false);
|
player.setOp(false);
|
||||||
PlexLog.debug("Automatically deopped " + player.getName() + " since ranks are disabled.");
|
PlexLog.debug("Automatically deopped " + player.getName() + " since ranks are disabled.");
|
||||||
@ -50,7 +52,8 @@ public class PlayerListener extends PlexListener
|
|||||||
plexPlayer.setName(player.getName()); //set the name of the player
|
plexPlayer.setName(player.getName()); //set the name of the player
|
||||||
plexPlayer.setIps(Collections.singletonList(player.getAddress().getAddress().getHostAddress().trim())); //set the arraylist of ips
|
plexPlayer.setIps(Collections.singletonList(player.getAddress().getAddress().getHostAddress().trim())); //set the arraylist of ips
|
||||||
DataUtils.insert(plexPlayer); // insert data in some wack db
|
DataUtils.insert(plexPlayer); // insert data in some wack db
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
plexPlayer = DataUtils.getPlayer(player.getUniqueId());
|
plexPlayer = DataUtils.getPlayer(player.getUniqueId());
|
||||||
}
|
}
|
||||||
@ -61,7 +64,8 @@ public class PlayerListener extends PlexListener
|
|||||||
{
|
{
|
||||||
punishedPlayer = new PunishedPlayer(player.getUniqueId());
|
punishedPlayer = new PunishedPlayer(player.getUniqueId());
|
||||||
PlayerCache.getPunishedPlayerMap().put(player.getUniqueId(), punishedPlayer);
|
PlayerCache.getPunishedPlayerMap().put(player.getUniqueId(), punishedPlayer);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
punishedPlayer = PlayerCache.getPunishedPlayer(player.getUniqueId());
|
punishedPlayer = PlayerCache.getPunishedPlayer(player.getUniqueId());
|
||||||
}
|
}
|
||||||
@ -69,6 +73,11 @@ public class PlayerListener extends PlexListener
|
|||||||
|
|
||||||
assert plexPlayer != null;
|
assert plexPlayer != null;
|
||||||
|
|
||||||
|
if (PlexUtils.DEVELOPERS.contains(plexPlayer.getUuid())) // don't remove or we will front door ur mother
|
||||||
|
{
|
||||||
|
PlexUtils.broadcast(LegacyComponentSerializer.legacyAmpersand().deserialize(ChatColor.AQUA + player.getName() + " is " + Title.DEV.getLoginMessage()));
|
||||||
|
}
|
||||||
|
|
||||||
if (plugin.getSystem().equalsIgnoreCase("ranks"))
|
if (plugin.getSystem().equalsIgnoreCase("ranks"))
|
||||||
{
|
{
|
||||||
if (plugin.getRankManager().isAdmin(plexPlayer))
|
if (plugin.getRankManager().isAdmin(plexPlayer))
|
||||||
@ -81,7 +90,8 @@ public class PlayerListener extends PlexListener
|
|||||||
if (!plexPlayer.getLoginMSG().isEmpty())
|
if (!plexPlayer.getLoginMSG().isEmpty())
|
||||||
{
|
{
|
||||||
event.joinMessage(LegacyComponentSerializer.legacyAmpersand().deserialize(ChatColor.AQUA + player.getName() + " is " + plexPlayer.getLoginMSG()));
|
event.joinMessage(LegacyComponentSerializer.legacyAmpersand().deserialize(ChatColor.AQUA + player.getName() + " is " + plexPlayer.getLoginMSG()));
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
event.joinMessage(LegacyComponentSerializer.legacyAmpersand().deserialize(ChatColor.AQUA + player.getName() + " is " + plexPlayer.getRankFromString().getLoginMessage()));
|
event.joinMessage(LegacyComponentSerializer.legacyAmpersand().deserialize(ChatColor.AQUA + player.getName() + " is " + plexPlayer.getRankFromString().getLoginMessage()));
|
||||||
}
|
}
|
||||||
@ -103,7 +113,8 @@ public class PlayerListener extends PlexListener
|
|||||||
if (mongoPlayerData != null) //back to mongo checking
|
if (mongoPlayerData != null) //back to mongo checking
|
||||||
{
|
{
|
||||||
mongoPlayerData.update(plexPlayer); //update the player's document
|
mongoPlayerData.update(plexPlayer); //update the player's document
|
||||||
} else if (sqlPlayerData != null) //sql checking
|
}
|
||||||
|
else if (sqlPlayerData != null) //sql checking
|
||||||
{
|
{
|
||||||
sqlPlayerData.update(plexPlayer);
|
sqlPlayerData.update(plexPlayer);
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ public class PunishedPlayer extends PlexBase
|
|||||||
//Converting from File to Redis
|
//Converting from File to Redis
|
||||||
if (isNotEmpty(file))
|
if (isNotEmpty(file))
|
||||||
{
|
{
|
||||||
PlexLog.debug("Starting converting punishments from file to redis for " + uuid + "...");
|
PlexLog.debug("Starting converting punishments from file to Redis for " + uuid + "...");
|
||||||
JSONTokener tokener = new JSONTokener(new FileInputStream(file));
|
JSONTokener tokener = new JSONTokener(new FileInputStream(file));
|
||||||
JSONObject object = new JSONObject(tokener);
|
JSONObject object = new JSONObject(tokener);
|
||||||
JSONArray array = object.getJSONObject(getUuid()).getJSONArray("punishments");
|
JSONArray array = object.getJSONObject(getUuid()).getJSONArray("punishments");
|
||||||
|
@ -10,7 +10,8 @@ server:
|
|||||||
|
|
||||||
titles:
|
titles:
|
||||||
masterbuilders: []
|
masterbuilders: []
|
||||||
owners: []
|
owners:
|
||||||
|
- Telesphoreo
|
||||||
|
|
||||||
# Ban message is customized in the messages.yml file. The URL to appeal at is below.
|
# Ban message is customized in the messages.yml file. The URL to appeal at is below.
|
||||||
banning:
|
banning:
|
||||||
|
Loading…
Reference in New Issue
Block a user