mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 17:17:37 +00:00
Reformat code
This commit is contained in:
parent
817cb03dca
commit
3f3bba57ac
@ -7,6 +7,7 @@ import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexLog;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import java.util.List;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -16,8 +17,6 @@ import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@CommandParameters(name = "debug", description = "Debug command", usage = "/<command> <redis-reset | gamerules> [player]")
|
||||
@CommandPermissions(level = Rank.EXECUTIVE, permission = "plex.debug")
|
||||
public class DebugCMD extends PlexCommand
|
||||
|
@ -11,16 +11,15 @@ 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 java.util.UUID;
|
||||
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;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandParameters(name = "mute", description = "Mute a player on the server", usage = "/<command> <player>", aliases = "stfu")
|
||||
@CommandPermissions(level = Rank.ADMIN, permission = "plex.mute")
|
||||
public class MuteCMD extends PlexCommand
|
||||
|
@ -85,8 +85,14 @@ public class TagCMD extends PlexCommand
|
||||
|
||||
private Component removeEvents(Component component)
|
||||
{
|
||||
if (component.clickEvent() != null) component = component.clickEvent(null);
|
||||
if (component.hoverEvent() != null) component = component.hoverEvent(null);
|
||||
if (component.clickEvent() != null)
|
||||
{
|
||||
component = component.clickEvent(null);
|
||||
}
|
||||
if (component.hoverEvent() != null)
|
||||
{
|
||||
component = component.hoverEvent(null);
|
||||
}
|
||||
return component;
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import dev.plex.cache.PlayerCache;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.PlayerNotBannedException;
|
||||
import dev.plex.command.exception.PlayerNotFoundException;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
@ -15,7 +14,6 @@ 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 java.util.UUID;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
@ -9,14 +9,13 @@ import dev.plex.command.exception.CommandFailException;
|
||||
import dev.plex.player.PunishedPlayer;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
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.util.List;
|
||||
|
||||
@CommandPermissions(level = Rank.ADMIN, permission = "plex.unmute")
|
||||
@CommandParameters(name = "unmute", description = "Unmute a player", usage = "/<command> <player>")
|
||||
public class UnmuteCMD extends PlexCommand
|
||||
|
@ -26,15 +26,15 @@ public class AdminAddEvent extends Event
|
||||
*/
|
||||
private final PlexPlayer plexPlayer;
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,14 +26,14 @@ public class AdminRemoveEvent extends Event
|
||||
*/
|
||||
private final PlexPlayer plexPlayer;
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
@ -32,14 +32,14 @@ public class AdminSetRankEvent extends Event
|
||||
*/
|
||||
private final Rank rank;
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
@ -21,14 +21,14 @@ public class GameModeUpdateEvent extends Event
|
||||
|
||||
private final GameMode gameMode;
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
@ -32,14 +32,14 @@ public class PunishedPlayerFreezeEvent extends PunishedPlayerEvent implements Ca
|
||||
this.frozen = frozen;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -32,14 +32,14 @@ public class PunishedPlayerMuteEvent extends PunishedPlayerEvent implements Canc
|
||||
this.muted = muted;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -22,6 +22,29 @@ public class ChatListener extends PlexListener
|
||||
{
|
||||
private final PlexChatRenderer renderer = new PlexChatRenderer();
|
||||
|
||||
public static void adminChat(CommandSender sender, String message)
|
||||
{
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (plugin.getSystem().equalsIgnoreCase("ranks"))
|
||||
{
|
||||
PlexPlayer plexPlayer = PlayerCache.getPlexPlayerMap().get(player.getUniqueId());
|
||||
if (plexPlayer.getRankFromString().isAtLeast(Rank.ADMIN))
|
||||
{
|
||||
player.sendMessage(PlexUtils.messageComponent("adminChatFormat", sender.getName(), message));
|
||||
}
|
||||
}
|
||||
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
|
||||
{
|
||||
if (player.hasPermission("plex.adminchat"))
|
||||
{
|
||||
player.sendMessage(PlexUtils.messageComponent("adminChatFormat", sender.getName(), message));
|
||||
}
|
||||
}
|
||||
}
|
||||
plugin.getServer().getConsoleSender().sendMessage(PlexUtils.messageComponent("adminChatFormat", sender.getName(), message));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onChat(AsyncChatEvent event)
|
||||
{
|
||||
@ -47,29 +70,6 @@ public class ChatListener extends PlexListener
|
||||
event.renderer(renderer);
|
||||
}
|
||||
|
||||
public static void adminChat(CommandSender sender, String message)
|
||||
{
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (plugin.getSystem().equalsIgnoreCase("ranks"))
|
||||
{
|
||||
PlexPlayer plexPlayer = PlayerCache.getPlexPlayerMap().get(player.getUniqueId());
|
||||
if (plexPlayer.getRankFromString().isAtLeast(Rank.ADMIN))
|
||||
{
|
||||
player.sendMessage(PlexUtils.messageComponent("adminChatFormat", sender.getName(), message));
|
||||
}
|
||||
}
|
||||
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
|
||||
{
|
||||
if (player.hasPermission("plex.adminchat"))
|
||||
{
|
||||
player.sendMessage(PlexUtils.messageComponent("adminChatFormat", sender.getName(), message));
|
||||
}
|
||||
}
|
||||
}
|
||||
plugin.getServer().getConsoleSender().sendMessage(PlexUtils.messageComponent("adminChatFormat", sender.getName(), message));
|
||||
}
|
||||
|
||||
public static class PlexChatRenderer implements ChatRenderer
|
||||
{
|
||||
public boolean hasPrefix;
|
||||
|
@ -111,8 +111,14 @@ public class PunishedPlayerMenu extends AbstractMenu
|
||||
return;
|
||||
}
|
||||
ItemStack item = event.getCurrentItem();
|
||||
if (!item.hasItemMeta()) return;
|
||||
if (!item.getItemMeta().hasDisplayName()) return;
|
||||
if (!item.hasItemMeta())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!item.getItemMeta().hasDisplayName())
|
||||
{
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
if (item.getType() == Material.FEATHER)
|
||||
{
|
||||
|
@ -19,21 +19,17 @@ import net.kyori.adventure.text.Component;
|
||||
@Setter
|
||||
public class Punishment
|
||||
{
|
||||
private static final String banUrl = Plex.get().config.getString("banning.ban_url");
|
||||
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("MM/dd/yyyy 'at' hh:mm:ss a");
|
||||
private final UUID punished;
|
||||
private final UUID punisher;
|
||||
|
||||
private final List<String> IPS;
|
||||
|
||||
private String punishedUsername;
|
||||
|
||||
private PunishmentType type;
|
||||
private String reason;
|
||||
|
||||
private boolean customTime;
|
||||
private boolean active; // Field is only for bans
|
||||
|
||||
private LocalDateTime endDate;
|
||||
|
||||
public Punishment(UUID punished, UUID punisher)
|
||||
{
|
||||
this.punished = punished;
|
||||
@ -47,22 +43,19 @@ public class Punishment
|
||||
this.endDate = null;
|
||||
}
|
||||
|
||||
private static final String banUrl = Plex.get().config.getString("banning.ban_url");
|
||||
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("MM/dd/yyyy 'at' hh:mm:ss a");
|
||||
|
||||
public static Component generateBanMessage(Punishment punishment)
|
||||
{
|
||||
return PlexUtils.messageComponent("banMessage", banUrl, punishment.getReason(),
|
||||
DATE_FORMAT.format(punishment.getEndDate()), punishment.getPunisher() == null ? "CONSOLE" : MojangUtils.getInfo(punishment.getPunisher().toString()).getUsername());
|
||||
}
|
||||
|
||||
public String toJSON()
|
||||
{
|
||||
return new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer()).create().toJson(this);
|
||||
}
|
||||
|
||||
public static Punishment fromJson(String json)
|
||||
{
|
||||
return new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeDeserializer()).create().fromJson(json, Punishment.class);
|
||||
}
|
||||
|
||||
public String toJSON()
|
||||
{
|
||||
return new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer()).create().toJson(this);
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,11 @@
|
||||
package dev.plex.services.impl;
|
||||
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.services.AbstractService;
|
||||
import dev.plex.util.PlexLog;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import org.apache.commons.lang.BooleanUtils;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.apache.commons.lang3.EnumUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameRule;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class GameRuleService extends AbstractService
|
||||
{
|
||||
public GameRuleService()
|
||||
@ -30,8 +23,6 @@ public class GameRuleService extends AbstractService
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int repeatInSeconds()
|
||||
{
|
||||
|
@ -44,12 +44,6 @@ import org.json.simple.parser.ParseException;
|
||||
|
||||
public class PlexUtils extends PlexBase
|
||||
{
|
||||
public static Map<String, ChatColor> CHAT_COLOR_NAMES;
|
||||
public static List<ChatColor> CHAT_COLOR_POOL;
|
||||
public static List<String> DEVELOPERS =
|
||||
Arrays.asList("78408086-1991-4c33-a571-d8fa325465b2", // Telesphoreo
|
||||
"f5cd54c4-3a24-4213-9a56-c06c49594dff" // Taahh
|
||||
);
|
||||
private static final Random RANDOM;
|
||||
private static final List<String> regxList = new ArrayList<>()
|
||||
{{
|
||||
@ -61,6 +55,12 @@ public class PlexUtils extends PlexBase
|
||||
add("m");
|
||||
add("s");
|
||||
}};
|
||||
public static Map<String, ChatColor> CHAT_COLOR_NAMES;
|
||||
public static List<ChatColor> CHAT_COLOR_POOL;
|
||||
public static List<String> DEVELOPERS =
|
||||
Arrays.asList("78408086-1991-4c33-a571-d8fa325465b2", // Telesphoreo
|
||||
"f5cd54c4-3a24-4213-9a56-c06c49594dff" // Taahh
|
||||
);
|
||||
|
||||
static
|
||||
{
|
||||
|
@ -8,8 +8,8 @@ import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
public abstract class CustomChunkGenerator extends ChunkGenerator
|
||||
{
|
||||
protected int height;
|
||||
private final List<BlockPopulator> populators;
|
||||
protected int height;
|
||||
|
||||
protected CustomChunkGenerator(int height, BlockPopulator... populators)
|
||||
{
|
||||
|
@ -24,17 +24,6 @@ public class CustomWorld extends WorldCreator
|
||||
this.generator(this.chunks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkGenerator generator()
|
||||
{
|
||||
return chunks;
|
||||
}
|
||||
|
||||
public World generate()
|
||||
{
|
||||
return this.createWorld();
|
||||
}
|
||||
|
||||
public static World generateConfigFlatWorld(String name)
|
||||
{
|
||||
if (!plugin.config.contains("worlds." + name))
|
||||
@ -66,4 +55,15 @@ public class CustomWorld extends WorldCreator
|
||||
};
|
||||
return customWorld.generate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkGenerator generator()
|
||||
{
|
||||
return chunks;
|
||||
}
|
||||
|
||||
public World generate()
|
||||
{
|
||||
return this.createWorld();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user