mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 09:07:37 +00:00
Reformat
This commit is contained in:
parent
223eaf30b3
commit
096bb1bb24
@ -1,3 +1,8 @@
|
||||
# Plex [![Build Status](https://ci.plex.us.org/job/Plex/job/master/badge/icon)](https://ci.plex.us.org/job/Plex/job/master/)
|
||||
|
||||
Plex is a new freedom plugin. It is an alternative to TotalFreedomMod. It has many of the features that make a freedom server unique, but also many features that TotalFreedomMod doesn’t have. For example, there is full support for using a permissions plugin instead of ranks. It is also much more performance oriented. You can use Redis to store indefinite bans and store player data in MongoDB, MariaDB, or SQLite. Plex is also fully customizable as you can change almost all of the messages within the plugin. Plex also has a module system which can be used to add additional functionality. Plex is not a rewrite, "debloat", or related to TotalFreedomMod. Plex is an entirely new experience.
|
||||
Plex is a new freedom plugin. It is an alternative to TotalFreedomMod. It has many of the features that make a freedom
|
||||
server unique, but also many features that TotalFreedomMod doesn’t have. For example, there is full support for using a
|
||||
permissions plugin instead of ranks. It is also much more performance oriented. You can use Redis to store indefinite
|
||||
bans and store player data in MongoDB, MariaDB, or SQLite. Plex is also fully customizable as you can change almost all
|
||||
of the messages within the plugin. Plex also has a module system which can be used to add additional functionality. Plex
|
||||
is not a rewrite, "debloat", or related to TotalFreedomMod. Plex is an entirely new experience.
|
||||
|
@ -50,7 +50,7 @@ dependencies {
|
||||
library "org.eclipse.jetty:jetty-proxy:11.0.9"
|
||||
library "com.google.code.gson:gson:2.9.0"
|
||||
compileOnly "io.papermc.paper:paper-api:1.18.2-R0.1-SNAPSHOT"
|
||||
compileOnly ("com.github.MilkBowl:VaultAPI:1.7") {
|
||||
compileOnly("com.github.MilkBowl:VaultAPI:1.7") {
|
||||
exclude group: "org.bukkit", module: "bukkit"
|
||||
}
|
||||
implementation "org.bstats:bstats-base:3.0.0"
|
||||
|
@ -3,12 +3,7 @@ package dev.plex;
|
||||
import dev.plex.admin.Admin;
|
||||
import dev.plex.admin.AdminList;
|
||||
import dev.plex.cache.DataUtils;
|
||||
import dev.plex.storage.permission.SQLPermissions;
|
||||
import dev.plex.storage.player.MongoPlayerData;
|
||||
import dev.plex.cache.PlayerCache;
|
||||
import dev.plex.storage.player.SQLPlayerData;
|
||||
import dev.plex.storage.punishment.SQLNotes;
|
||||
import dev.plex.storage.punishment.SQLPunishment;
|
||||
import dev.plex.config.Config;
|
||||
import dev.plex.handlers.CommandHandler;
|
||||
import dev.plex.handlers.ListenerHandler;
|
||||
@ -21,10 +16,18 @@ import dev.plex.storage.MongoConnection;
|
||||
import dev.plex.storage.RedisConnection;
|
||||
import dev.plex.storage.SQLConnection;
|
||||
import dev.plex.storage.StorageType;
|
||||
import dev.plex.storage.permission.SQLPermissions;
|
||||
import dev.plex.storage.player.MongoPlayerData;
|
||||
import dev.plex.storage.player.SQLPlayerData;
|
||||
import dev.plex.storage.punishment.SQLNotes;
|
||||
import dev.plex.storage.punishment.SQLPunishment;
|
||||
import dev.plex.util.PlexLog;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import dev.plex.util.UpdateChecker;
|
||||
import dev.plex.world.CustomWorld;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
@ -33,10 +36,6 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class Plex extends JavaPlugin
|
||||
@ -122,7 +121,8 @@ public class Plex extends JavaPlugin
|
||||
{
|
||||
PlexUtils.testConnections();
|
||||
PlexLog.log("Connected to " + storageType.name().toUpperCase());
|
||||
} catch (Exception e)
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PlexLog.error("Failed to connect to " + storageType.name().toUpperCase());
|
||||
e.printStackTrace();
|
||||
@ -144,7 +144,8 @@ public class Plex extends JavaPlugin
|
||||
{
|
||||
redisConnection.getJedis();
|
||||
PlexLog.log("Connected to Redis!");
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
PlexLog.log("Redis is disabled in the configuration file, not connecting.");
|
||||
}
|
||||
@ -152,7 +153,8 @@ public class Plex extends JavaPlugin
|
||||
if (storageType == StorageType.MONGODB)
|
||||
{
|
||||
mongoPlayerData = new MongoPlayerData();
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
sqlPlayerData = new SQLPlayerData();
|
||||
sqlPunishment = new SQLPunishment();
|
||||
@ -198,7 +200,8 @@ public class Plex extends JavaPlugin
|
||||
if (mongoPlayerData != null) //back to mongo checking
|
||||
{
|
||||
mongoPlayerData.update(plexPlayer); //update the player's document
|
||||
} else if (sqlPlayerData != null) //sql checking
|
||||
}
|
||||
else if (sqlPlayerData != null) //sql checking
|
||||
{
|
||||
sqlPlayerData.update(plexPlayer);
|
||||
}
|
||||
@ -261,7 +264,8 @@ public class Plex extends JavaPlugin
|
||||
author = props.getProperty("buildAuthor", "unknown");
|
||||
date = props.getProperty("buildDate", "unknown");
|
||||
head = props.getProperty("buildHead", "unknown");
|
||||
} catch (Exception ex)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
PlexLog.error("Could not load build properties! Did you compile with NetBeans/Maven?");
|
||||
}
|
||||
|
@ -5,12 +5,18 @@ import dev.plex.cache.DataUtils;
|
||||
import dev.plex.cache.PlayerCache;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.*;
|
||||
import dev.plex.command.exception.CommandFailException;
|
||||
import dev.plex.command.exception.ConsoleMustDefinePlayerException;
|
||||
import dev.plex.command.exception.ConsoleOnlyException;
|
||||
import dev.plex.command.exception.PlayerNotBannedException;
|
||||
import dev.plex.command.exception.PlayerNotFoundException;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexLog;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
@ -18,14 +24,15 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.*;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.command.PluginIdentifiableCommand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Superclass for all commands
|
||||
*/
|
||||
@ -124,7 +131,8 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
|
||||
{
|
||||
send(sender, messageComponent("noPermissionRank", ChatColor.stripColor(getLevel().getLoginMessage())));
|
||||
return true;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (getLevel().isAtLeast(Rank.ADMIN) && !plexPlayer.isAdminActive())
|
||||
{
|
||||
@ -132,14 +140,16 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (plugin.getSystem().equalsIgnoreCase("permissions"))
|
||||
}
|
||||
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
|
||||
{
|
||||
if (!player.hasPermission(perms.permission()))
|
||||
{
|
||||
send(sender, messageComponent("noPermissionNode", perms.permission()));
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
PlexLog.error("Neither permissions or ranks were selected to be used in the configuration file!");
|
||||
send(sender, "There is a server misconfiguration. Please alert a developer or the owner");
|
||||
@ -157,7 +167,8 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
|
||||
{
|
||||
send(sender, messageComponent("noPermissionRank", ChatColor.stripColor(getLevel().getLoginMessage())));
|
||||
return true;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (getLevel().isAtLeast(Rank.ADMIN) && !plexPlayer.isAdminActive())
|
||||
{
|
||||
@ -165,14 +176,16 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (plugin.getSystem().equalsIgnoreCase("permissions"))
|
||||
}
|
||||
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
|
||||
{
|
||||
if (!plugin.getPermissions().playerHas(null, Bukkit.getOfflinePlayer(plexPlayer.getUuid()), perms.permission()))
|
||||
{
|
||||
send(sender, messageComponent("noPermissionNode", perms.permission()));
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
PlexLog.error("Neither permissions or ranks were selected to be used in the configuration file!");
|
||||
send(sender, "There is a server misconfiguration. Please alert a developer or the owner");
|
||||
@ -181,12 +194,14 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
|
||||
}
|
||||
try
|
||||
{
|
||||
Component component = this.execute(sender, isConsole(sender) ? null : (Player) sender, args);
|
||||
Component component = this.execute(sender, isConsole(sender) ? null : (Player)sender, args);
|
||||
if (component != null)
|
||||
{
|
||||
send(sender, component);
|
||||
}
|
||||
} catch (PlayerNotFoundException | CommandFailException | ConsoleOnlyException | ConsoleMustDefinePlayerException | PlayerNotBannedException ex)
|
||||
}
|
||||
catch (PlayerNotFoundException | CommandFailException | ConsoleOnlyException |
|
||||
ConsoleMustDefinePlayerException | PlayerNotBannedException ex)
|
||||
{
|
||||
send(sender, PlexUtils.mmDeserialize(ex.getMessage()));
|
||||
}
|
||||
@ -210,7 +225,8 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (params.aliases().split(",").length < 1)
|
||||
}
|
||||
else if (params.aliases().split(",").length < 1)
|
||||
{
|
||||
return getName().equalsIgnoreCase(label);
|
||||
}
|
||||
@ -264,7 +280,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
|
||||
{
|
||||
if (!isConsole(sender))
|
||||
{
|
||||
return checkRank((Player) sender, rank, permission);
|
||||
return checkRank((Player)sender, rank, permission);
|
||||
}
|
||||
if (!sender.getName().equalsIgnoreCase("console"))
|
||||
{
|
||||
@ -279,7 +295,8 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
|
||||
{
|
||||
throw new CommandFailException(PlexUtils.messageString("noPermissionRank", ChatColor.stripColor(rank.getLoginMessage())));
|
||||
}
|
||||
} else if (plugin.getSystem().equalsIgnoreCase("permissions"))
|
||||
}
|
||||
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
|
||||
{
|
||||
if (!plugin.getPermissions().playerHas(null, Bukkit.getOfflinePlayer(plexPlayer.getUuid()), permission))
|
||||
{
|
||||
@ -316,7 +333,8 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
|
||||
{
|
||||
throw new CommandFailException(PlexUtils.messageString("noPermissionRank", ChatColor.stripColor(rank.getLoginMessage())));
|
||||
}
|
||||
} else if (plugin.getSystem().equalsIgnoreCase("permissions"))
|
||||
}
|
||||
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
|
||||
{
|
||||
if (!player.hasPermission(permission))
|
||||
{
|
||||
@ -336,7 +354,8 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
|
||||
if (plugin.getSystem().equalsIgnoreCase("ranks"))
|
||||
{
|
||||
return rank.isAtLeast(Rank.ADMIN) ? plexPlayer.isAdminActive() && plexPlayer.getRankFromString().isAtLeast(rank) : plexPlayer.getRankFromString().isAtLeast(rank);
|
||||
} else if (plugin.getSystem().equalsIgnoreCase("permissions"))
|
||||
}
|
||||
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
|
||||
{
|
||||
return player.hasPermission(permission);
|
||||
}
|
||||
@ -356,7 +375,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
|
||||
{
|
||||
if (!isConsole(sender))
|
||||
{
|
||||
return checkTab((Player) sender, rank, permission);
|
||||
return checkTab((Player)sender, rank, permission);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -376,7 +395,8 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
|
||||
if (plugin.getSystem().equalsIgnoreCase("ranks"))
|
||||
{
|
||||
return rank.isAtLeast(Rank.ADMIN) ? plexPlayer.isAdminActive() && plexPlayer.getRankFromString().isAtLeast(rank) : plexPlayer.getRankFromString().isAtLeast(rank);
|
||||
} else if (plugin.getSystem().equalsIgnoreCase("permissions"))
|
||||
}
|
||||
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
|
||||
{
|
||||
return player.hasPermission(permission);
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
package dev.plex.command.blocking;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class BlockedCommand
|
||||
{
|
||||
|
@ -14,11 +14,9 @@ import dev.plex.event.AdminRemoveEvent;
|
||||
import dev.plex.event.AdminSetRankEvent;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexLog;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -14,6 +14,9 @@ import dev.plex.punishment.PunishmentType;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexLog;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -22,10 +25,6 @@ import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandParameters(name = "ban", usage = "/<command> <player> [reason]", aliases = "offlineban,gtfo", description = "Bans a player, offline or online")
|
||||
@CommandPermissions(level = Rank.ADMIN, permission = "plex.ban", source = RequiredCommandSource.ANY)
|
||||
|
||||
@ -78,7 +77,8 @@ public class BanCMD extends PlexCommand
|
||||
{
|
||||
reason = StringUtils.join(args, " ", 1, args.length);
|
||||
punishment.setReason(reason);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
punishment.setReason("No reason provided.");
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import dev.plex.command.annotation.System;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexLog;
|
||||
import dev.plex.util.PlexUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
@ -7,6 +7,10 @@ import dev.plex.command.source.RequiredCommandSource;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
@ -17,11 +21,6 @@ import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = Rank.ADMIN, permission = "plex.entitywipe", source = RequiredCommandSource.ANY)
|
||||
@CommandParameters(name = "entitywipe", description = "Remove various server entities that may cause lag, such as dropped items, minecarts, and boats.", usage = "/<command> [name]", aliases = "ew,rd")
|
||||
public class EntityWipeCMD extends PlexCommand
|
||||
|
@ -9,15 +9,14 @@ import dev.plex.punishment.Punishment;
|
||||
import dev.plex.punishment.PunishmentType;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@CommandParameters(name = "freeze", description = "Freeze a player on the server", usage = "/<command> <player>", aliases = "fr")
|
||||
@CommandPermissions(level = Rank.ADMIN, permission = "plex.freeze")
|
||||
public class FreezeCMD extends PlexCommand
|
||||
|
@ -6,16 +6,17 @@ import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import java.util.HashMap;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Mob;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@CommandPermissions(level = Rank.ADMIN, permission = "plex.mobpurge", source = RequiredCommandSource.ANY)
|
||||
@CommandParameters(name = "mobpurge", description = "Purge all mobs.", usage = "/<command>", aliases = "mp")
|
||||
public class MobPurgeCMD extends PlexCommand
|
||||
|
@ -10,7 +10,6 @@ import dev.plex.util.AshconInfo;
|
||||
import dev.plex.util.MojangUtils;
|
||||
import dev.plex.util.PlexLog;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
@ -9,9 +9,13 @@ import dev.plex.punishment.extra.Note;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.storage.StorageType;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.format.TextDecoration;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -19,13 +23,6 @@ import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
@CommandParameters(name = "notes", description = "Manage notes for a player", usage = "/<command> <player> <list | add <note> | remove <id> | clear>")
|
||||
@CommandPermissions(level = Rank.ADMIN, permission = "plex.notes")
|
||||
public class NotesCMD extends PlexCommand
|
||||
|
@ -11,6 +11,10 @@ import dev.plex.module.PlexModuleFile;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexLog;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -18,11 +22,6 @@ import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, permission = "plex.plex", source = RequiredCommandSource.ANY)
|
||||
@CommandParameters(name = "plex", usage = "/<command> [reload | redis | modules [reload]]", description = "Show information about Plex or reload it")
|
||||
public class PlexCMD extends PlexCommand
|
||||
@ -65,7 +64,8 @@ public class PlexCMD extends PlexCommand
|
||||
PlexLog.debug("Restarted services");
|
||||
send(sender, "Plex successfully reloaded.");
|
||||
return null;
|
||||
} else if (args[0].equalsIgnoreCase("redis"))
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("redis"))
|
||||
{
|
||||
checkRank(sender, Rank.SENIOR_ADMIN, "plex.redis");
|
||||
if (!plugin.getRedisConnection().isEnabled())
|
||||
@ -77,7 +77,8 @@ public class PlexCMD extends PlexCommand
|
||||
send(sender, plugin.getRedisConnection().getJedis().get("test"));
|
||||
plugin.getRedisConnection().getJedis().close();
|
||||
return null;
|
||||
} else if (args[0].equalsIgnoreCase("modules"))
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("modules"))
|
||||
{
|
||||
if (args.length == 1)
|
||||
{
|
||||
@ -92,7 +93,8 @@ public class PlexCMD extends PlexCommand
|
||||
plugin.getModuleManager().enableModules();
|
||||
return mmString("<green>All modules reloaded!");
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("update"))
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("update"))
|
||||
{
|
||||
if (sender instanceof Player player && !PlexUtils.DEVELOPERS.contains(player.getUniqueId().toString()))
|
||||
{
|
||||
@ -104,7 +106,8 @@ public class PlexCMD extends PlexCommand
|
||||
}
|
||||
plugin.getUpdateChecker().updateJar(sender);
|
||||
return null;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
return usage();
|
||||
}
|
||||
@ -117,7 +120,8 @@ public class PlexCMD extends PlexCommand
|
||||
if (args.length == 1)
|
||||
{
|
||||
return Arrays.asList("reload", "redis", "modules");
|
||||
} else if (args[0].equalsIgnoreCase("modules"))
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("modules"))
|
||||
{
|
||||
return List.of("reload");
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import dev.plex.command.source.RequiredCommandSource;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -10,9 +10,7 @@ import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
import net.kyori.adventure.text.minimessage.tag.standard.StandardTags;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -14,7 +14,6 @@ import dev.plex.util.PlexUtils;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -39,7 +39,8 @@ public class CommandHandler extends PlexBase
|
||||
commands.add(clazz.getConstructor().newInstance());
|
||||
}
|
||||
}
|
||||
catch (InvocationTargetException | InstantiationException | IllegalAccessException | NoSuchMethodException ex)
|
||||
catch (InvocationTargetException | InstantiationException | IllegalAccessException |
|
||||
NoSuchMethodException ex)
|
||||
{
|
||||
PlexLog.error("Failed to register " + clazz.getSimpleName() + " as a command!");
|
||||
}
|
||||
|
@ -34,7 +34,8 @@ public class ListenerHandler extends PlexBase
|
||||
listeners.add(clazz.getConstructor().newInstance());
|
||||
}
|
||||
}
|
||||
catch (InvocationTargetException | InstantiationException | IllegalAccessException | NoSuchMethodException ex)
|
||||
catch (InvocationTargetException | InstantiationException | IllegalAccessException |
|
||||
NoSuchMethodException ex)
|
||||
{
|
||||
PlexLog.error("Failed to register " + clazz.getSimpleName() + " as a listener!");
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
package dev.plex.listener.impl;
|
||||
|
||||
import dev.plex.listener.PlexListener;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import dev.plex.util.PlexUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
|
@ -8,6 +8,10 @@ import dev.plex.player.PlexPlayer;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.services.impl.CommandBlockerService;
|
||||
import dev.plex.util.PlexLog;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -16,11 +20,6 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class CommandListener extends PlexListener
|
||||
{
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@ -54,7 +53,7 @@ public class CommandListener extends PlexListener
|
||||
String[] cmdArgs = event.getMessage().replaceFirst("/", "").split(" ");
|
||||
for (int i = 0; i < args.length; i++)
|
||||
{
|
||||
if (i+1 > cmdArgs.length)
|
||||
if (i + 1 > cmdArgs.length)
|
||||
{
|
||||
matches = false;
|
||||
break;
|
||||
@ -104,11 +103,13 @@ public class CommandListener extends PlexListener
|
||||
BlockedCommand cmd = cmdRef.get();
|
||||
switch (cmd.getRequiredLevel().toLowerCase(Locale.ROOT))
|
||||
{
|
||||
case "e" -> {
|
||||
case "e" ->
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().sendMessage(cmd.getMessage());
|
||||
}
|
||||
case "a" -> {
|
||||
case "a" ->
|
||||
{
|
||||
if (plexPlayer.isAdminActive() && plexPlayer.getRankFromString().isAtLeast(Rank.ADMIN))
|
||||
{
|
||||
return;
|
||||
@ -116,7 +117,8 @@ public class CommandListener extends PlexListener
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().sendMessage(cmd.getMessage());
|
||||
}
|
||||
case "s" -> {
|
||||
case "s" ->
|
||||
{
|
||||
if (plexPlayer.isAdminActive() && plexPlayer.getRankFromString().isAtLeast(Rank.SENIOR_ADMIN))
|
||||
{
|
||||
return;
|
||||
|
@ -7,6 +7,8 @@ import dev.plex.player.PlexPlayer;
|
||||
import dev.plex.storage.StorageType;
|
||||
import dev.plex.util.PlexLog;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
@ -19,9 +21,6 @@ import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class PlayerListener<T> extends PlexListener
|
||||
{
|
||||
// setting up a player's data
|
||||
|
@ -1,7 +1,6 @@
|
||||
package dev.plex.listener.impl;
|
||||
|
||||
import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
|
||||
import com.destroystokyo.paper.event.server.ServerTickEndEvent;
|
||||
import dev.plex.listener.PlexListener;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import java.util.List;
|
||||
@ -9,7 +8,6 @@ import java.util.stream.Collectors;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
|
||||
public class ServerListener extends PlexListener
|
||||
{
|
||||
|
@ -2,6 +2,9 @@ package dev.plex.listener.impl;
|
||||
|
||||
import dev.plex.listener.PlexListener;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@ -20,10 +23,6 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class SpawnListener extends PlexListener
|
||||
{
|
||||
private static final List<Material> SPAWN_EGGS = Arrays.stream(Material.values()).filter((mat) -> mat.name().endsWith("_SPAWN_EGG")).toList();
|
||||
|
@ -156,16 +156,20 @@ public class WorldListener extends PlexListener
|
||||
Title title = Title.valueOf(titleString.toUpperCase(Locale.ROOT));
|
||||
switch (title)
|
||||
{
|
||||
case DEV -> {
|
||||
case DEV ->
|
||||
{
|
||||
hasAccess = PlexUtils.DEVELOPERS.contains(player.getUuid().toString());
|
||||
}
|
||||
case MASTER_BUILDER -> {
|
||||
case MASTER_BUILDER ->
|
||||
{
|
||||
hasAccess = Plex.get().config.contains("titles.masterbuilders") && Plex.get().config.getStringList("titles.masterbuilders").contains(player.getName());
|
||||
}
|
||||
case OWNER -> {
|
||||
case OWNER ->
|
||||
{
|
||||
hasAccess = Plex.get().config.contains("titles.owners") && Plex.get().config.getStringList("titles.owners").contains(player.getName());
|
||||
}
|
||||
default -> {
|
||||
default ->
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,8 @@ public class ModuleManager
|
||||
plexModule.setLogger(LogManager.getLogger(plexModuleFile.getName()));
|
||||
modules.add(plexModule);
|
||||
}
|
||||
catch (MalformedURLException | ClassNotFoundException | InvocationTargetException | InstantiationException | IllegalAccessException | NoSuchMethodException e)
|
||||
catch (MalformedURLException | ClassNotFoundException | InvocationTargetException |
|
||||
InstantiationException | IllegalAccessException | NoSuchMethodException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
package dev.plex.permission;
|
||||
|
||||
import dev.morphia.annotations.Entity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.UUID;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
|
@ -12,14 +12,11 @@ import dev.plex.punishment.Punishment;
|
||||
import dev.plex.punishment.extra.Note;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.storage.StorageType;
|
||||
|
||||
import dev.plex.util.adapter.LocalDateTimeSerializer;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import dev.plex.util.adapter.LocalDateTimeSerializer;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
@ -3,10 +3,9 @@ package dev.plex.punishment.extra;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import dev.morphia.annotations.Entity;
|
||||
import dev.plex.util.adapter.LocalDateTimeSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
|
@ -14,7 +14,6 @@ import java.util.stream.Collectors;
|
||||
import lombok.SneakyThrows;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.tag.standard.StandardTags;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
@ -5,7 +5,6 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@Getter
|
||||
|
@ -5,7 +5,6 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@Getter
|
||||
|
@ -2,12 +2,15 @@ package dev.plex.services;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.services.impl.*;
|
||||
import dev.plex.services.impl.AutoWipeService;
|
||||
import dev.plex.services.impl.BanService;
|
||||
import dev.plex.services.impl.CommandBlockerService;
|
||||
import dev.plex.services.impl.GameRuleService;
|
||||
import dev.plex.services.impl.UpdateCheckerService;
|
||||
import java.util.List;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ServiceManager
|
||||
{
|
||||
private final List<AbstractService> services = Lists.newArrayList();
|
||||
|
@ -2,12 +2,11 @@ package dev.plex.services.impl;
|
||||
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.services.AbstractService;
|
||||
import java.util.List;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AutoWipeService extends AbstractService
|
||||
{
|
||||
public AutoWipeService()
|
||||
|
@ -5,13 +5,10 @@ import dev.plex.command.blocking.BlockedCommand;
|
||||
import dev.plex.services.AbstractService;
|
||||
import dev.plex.util.PlexLog;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.command.Command;
|
||||
|
||||
public class CommandBlockerService extends AbstractService
|
||||
{
|
||||
|
@ -4,11 +4,10 @@ import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.PlexBase;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class SQLConnection extends PlexBase
|
||||
|
@ -3,7 +3,6 @@ package dev.plex.storage.permission;
|
||||
import com.google.common.collect.Lists;
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.permission.Permission;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@ -33,7 +32,8 @@ public class SQLPermissions
|
||||
permission.setAllowed(set.getBoolean("allowed"));
|
||||
permissions.add(permission);
|
||||
}
|
||||
} catch (SQLException e)
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -49,7 +49,8 @@ public class SQLPermissions
|
||||
statement.setString(2, permission.getPermission().toLowerCase(Locale.ROOT));
|
||||
statement.setBoolean(3, permission.isAllowed());
|
||||
statement.execute();
|
||||
} catch (SQLException e)
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -64,7 +65,8 @@ public class SQLPermissions
|
||||
statement.setString(2, permission.getUuid().toString());
|
||||
statement.setString(3, permission.getPermission().toLowerCase(Locale.ROOT));
|
||||
statement.executeUpdate();
|
||||
} catch (SQLException e)
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -83,7 +85,8 @@ public class SQLPermissions
|
||||
statement.setString(1, uuid.toString());
|
||||
statement.setString(2, permission.toLowerCase(Locale.ROOT));
|
||||
statement.execute();
|
||||
} catch (SQLException e)
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package dev.plex.storage.punishment;
|
||||
import com.google.common.collect.Lists;
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.punishment.extra.Note;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
|
@ -5,7 +5,6 @@ import dev.plex.Plex;
|
||||
import dev.plex.punishment.Punishment;
|
||||
import dev.plex.punishment.PunishmentType;
|
||||
import dev.plex.util.PlexLog;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@ -47,7 +46,8 @@ public class SQLPunishment
|
||||
punishment.setIp(set.getString("ip"));
|
||||
punishments.add(punishment);
|
||||
}
|
||||
} catch (SQLException e)
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return punishments;
|
||||
@ -76,7 +76,8 @@ public class SQLPunishment
|
||||
punishment.setIp(set.getString("ip"));
|
||||
punishments.add(punishment);
|
||||
}
|
||||
} catch (SQLException e)
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -103,7 +104,8 @@ public class SQLPunishment
|
||||
statement.setLong(9, punishment.getEndDate().toInstant(ZoneOffset.UTC).toEpochMilli());
|
||||
PlexLog.debug("Executing punishment");
|
||||
statement.execute();
|
||||
} catch (SQLException e)
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -119,7 +121,8 @@ public class SQLPunishment
|
||||
statement.setBoolean(2, true);
|
||||
statement.setString(3, uuid.toString());
|
||||
statement.setString(4, PunishmentType.BAN.name());
|
||||
} catch (SQLException e)
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -137,7 +140,8 @@ public class SQLPunishment
|
||||
statement.setString(3, uuid.toString());
|
||||
statement.setString(4, PunishmentType.BAN.name());
|
||||
statement.executeUpdate();
|
||||
} catch (SQLException e)
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -10,24 +10,6 @@ import dev.plex.config.Config;
|
||||
import dev.plex.permission.Permission;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
import dev.plex.storage.StorageType;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
import net.kyori.adventure.text.minimessage.tag.standard.*;
|
||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.PluginCommandYamlParser;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionAttachment;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
@ -39,9 +21,44 @@ import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.Month;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.stream.Collectors;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
import net.kyori.adventure.text.minimessage.tag.standard.StandardTags;
|
||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameRule;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.PluginCommandYamlParser;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionAttachment;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
public class PlexUtils extends PlexBase
|
||||
{
|
||||
|
@ -6,9 +6,17 @@ import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.PlexBase;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
@ -19,16 +27,6 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class UpdateChecker extends PlexBase
|
||||
{
|
||||
/*
|
||||
@ -114,28 +112,32 @@ public class UpdateChecker extends PlexBase
|
||||
|
||||
switch (distance)
|
||||
{
|
||||
case -1 -> {
|
||||
case -1 ->
|
||||
{
|
||||
if (verbosity == 2)
|
||||
{
|
||||
sender.sendMessage(Component.text("There was an error checking for updates.").color(NamedTextColor.RED));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
case 0 -> {
|
||||
case 0 ->
|
||||
{
|
||||
if (verbosity == 2)
|
||||
{
|
||||
sender.sendMessage(Component.text("Plex is up to date!").color(NamedTextColor.GREEN));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
case -2 -> {
|
||||
case -2 ->
|
||||
{
|
||||
if (verbosity == 2)
|
||||
{
|
||||
sender.sendMessage(Component.text("Unknown version, unable to check for updates.").color(NamedTextColor.RED));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
default -> {
|
||||
default ->
|
||||
{
|
||||
if (verbosity >= 1)
|
||||
{
|
||||
sender.sendMessage(Component.text("Plex is not up to date!", NamedTextColor.RED));
|
||||
|
@ -1,5 +1,6 @@
|
||||
package dev.plex.util.item;
|
||||
|
||||
import java.util.Arrays;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
@ -9,8 +10,6 @@ import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class ItemBuilder
|
||||
{
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user