mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 17:17:37 +00:00
Big update
This commit is contained in:
parent
921a62cd58
commit
88c70e84cc
21
pom.xml
21
pom.xml
@ -32,17 +32,10 @@
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.17-R0.1-SNAPSHOT</version>
|
||||
<version>1.18.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.papermc</groupId>
|
||||
<artifactId>paperlib</artifactId>
|
||||
<version>1.0.6</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- UTILITIES -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
@ -54,14 +47,14 @@
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20210307</version>
|
||||
<version>20211205</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.8.0</version>
|
||||
<version>2.11.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
@ -76,13 +69,13 @@
|
||||
<dependency>
|
||||
<groupId>dev.morphia.morphia</groupId>
|
||||
<artifactId>morphia-core</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>2.2.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<version>4.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -106,8 +99,8 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>16</source>
|
||||
<target>16</target>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
@ -1,7 +1,5 @@
|
||||
package dev.plex;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import dev.plex.admin.AdminList;
|
||||
import dev.plex.banning.BanManager;
|
||||
import dev.plex.cache.MongoPlayerData;
|
||||
@ -19,6 +17,8 @@ import dev.plex.storage.StorageType;
|
||||
import dev.plex.util.PlexLog;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import dev.plex.world.CustomWorld;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@Getter
|
||||
|
@ -1,10 +1,11 @@
|
||||
package dev.plex.admin;
|
||||
|
||||
import java.util.UUID;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
@ -6,7 +6,9 @@ import dev.morphia.Datastore;
|
||||
import dev.morphia.query.Query;
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.storage.StorageType;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@ -14,7 +16,6 @@ import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
|
||||
public class AdminList
|
||||
{
|
||||
@ -31,7 +32,6 @@ public class AdminList
|
||||
admins.remove(uuid);
|
||||
}
|
||||
|
||||
|
||||
public List<String> getAllAdmins()
|
||||
{
|
||||
List<String> admins = Lists.newArrayList();
|
||||
|
3
src/main/java/dev/plex/cache/DataUtils.java
vendored
3
src/main/java/dev/plex/cache/DataUtils.java
vendored
@ -3,9 +3,10 @@ package dev.plex.cache;
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
import dev.plex.storage.StorageType;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class DataUtils
|
||||
{
|
||||
/* PLEX PLAYER METHODS */
|
||||
|
@ -7,6 +7,7 @@ import dev.morphia.query.experimental.filters.Filters;
|
||||
import dev.morphia.query.experimental.updates.UpdateOperators;
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class MongoPlayerData
|
||||
|
@ -3,6 +3,7 @@ package dev.plex.cache;
|
||||
import com.google.common.collect.Maps;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
import dev.plex.player.PunishedPlayer;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -4,6 +4,7 @@ import com.google.common.reflect.TypeToken;
|
||||
import com.google.gson.Gson;
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.plex.command;
|
||||
|
||||
import dev.plex.command.source.CommandSource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IPlexCommand
|
||||
|
@ -2,6 +2,8 @@ package dev.plex.command;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.Plex;
|
||||
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.CommandArgumentException;
|
||||
@ -9,24 +11,19 @@ import dev.plex.command.exception.CommandFailException;
|
||||
import dev.plex.command.exception.PlayerNotFoundException;
|
||||
import dev.plex.command.source.CommandSource;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import dev.plex.cache.DataUtils;
|
||||
import dev.plex.cache.PlayerCache;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.command.*;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public abstract class PlexCommand extends Command implements TabExecutor, IPlexCommand
|
||||
{
|
||||
protected static Plex plugin = Plex.get();
|
||||
@ -55,7 +52,7 @@ public abstract class PlexCommand extends Command implements TabExecutor, IPlexC
|
||||
this.level = perms.level();
|
||||
this.commandSource = perms.source();
|
||||
|
||||
getMap().register("", this);
|
||||
getMap().register("plex", this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
package dev.plex.command.annotation;
|
||||
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface CommandPermissions
|
||||
|
@ -1,17 +1,14 @@
|
||||
package dev.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.cache.DataUtils;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.ConsoleOnlyException;
|
||||
import dev.plex.command.exception.PlayerNotFoundException;
|
||||
import dev.plex.command.source.CommandSource;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import dev.plex.cache.DataUtils;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.event.AdminAddEvent;
|
||||
import dev.plex.event.AdminRemoveEvent;
|
||||
import dev.plex.event.AdminSetRankEvent;
|
||||
@ -21,6 +18,10 @@ import dev.plex.util.PlexUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = RequiredCommandSource.ANY)
|
||||
@CommandParameters(usage = "/<command> <add | remove | setrank | list> [player] [rank]", aliases = "saconfig,slconfig,adminconfig,adminmanage", description = "Manage all admins")
|
||||
public class AdminCMD extends PlexCommand
|
||||
@ -51,6 +52,7 @@ public class AdminCMD extends PlexCommand
|
||||
|
||||
if (!sender.isConsoleSender())
|
||||
{
|
||||
sender.send(tl("consoleOnly"));
|
||||
throw new ConsoleOnlyException();
|
||||
}
|
||||
|
||||
@ -165,7 +167,6 @@ public class AdminCMD extends PlexCommand
|
||||
}
|
||||
|
||||
sender.send("Admins: " + StringUtils.join(plugin.getAdminList().getAllAdmins(), ", "));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,24 +1,17 @@
|
||||
package dev.plex.command.impl;
|
||||
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.CommandFailException;
|
||||
import dev.plex.command.source.CommandSource;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.ADMIN, source = RequiredCommandSource.IN_GAME)
|
||||
@CommandParameters(aliases = "aw", description = "Teleport to the adminworld")
|
||||
public class AdminworldCMD extends PlexCommand
|
||||
@ -35,7 +28,7 @@ public class AdminworldCMD extends PlexCommand
|
||||
if (args.length == 0)
|
||||
{
|
||||
Location loc = new Location(Bukkit.getWorld("adminworld"), 0, 50, 0);
|
||||
PaperLib.teleportAsync(sender.getPlayer(), loc);
|
||||
sender.getPlayer().teleportAsync(loc);
|
||||
send(tl("teleportedToWorld", "adminworld"));
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
package dev.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.CommandFailException;
|
||||
import dev.plex.command.source.CommandSource;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = RequiredCommandSource.ANY)
|
||||
@CommandParameters(aliases = "gma", description = "Set your own or another player's gamemode to adventure mode")
|
||||
public class AdventureCMD extends PlexCommand
|
||||
|
@ -1,18 +1,18 @@
|
||||
package dev.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.cache.DataUtils;
|
||||
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.PlayerNotFoundException;
|
||||
import dev.plex.command.source.CommandSource;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import dev.plex.punishment.Punishment;
|
||||
import dev.plex.punishment.PunishmentType;
|
||||
import dev.plex.cache.DataUtils;
|
||||
import dev.plex.cache.PlayerCache;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
import dev.plex.player.PunishedPlayer;
|
||||
import dev.plex.punishment.Punishment;
|
||||
import dev.plex.punishment.PunishmentType;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -1,20 +1,20 @@
|
||||
package dev.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.CommandFailException;
|
||||
import dev.plex.command.source.CommandSource;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = RequiredCommandSource.ANY)
|
||||
@CommandParameters(aliases = "gmc", description = "Set your own or another player's gamemode to creative mode")
|
||||
public class CreativeCMD extends PlexCommand
|
||||
|
@ -1,33 +1,26 @@
|
||||
package dev.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
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.CommandArgumentException;
|
||||
import dev.plex.command.exception.CommandFailException;
|
||||
import dev.plex.command.source.CommandSource;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import dev.plex.cache.PlayerCache;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import dev.plex.world.BlockMapChunkGenerator;
|
||||
import dev.plex.world.CustomWorld;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.entity.Enderman;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Strider;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@CommandParameters(description = "Subliminal message.")
|
||||
@CommandPermissions(source = RequiredCommandSource.IN_GAME)
|
||||
public class FionnCMD extends PlexCommand
|
||||
|
@ -1,24 +1,17 @@
|
||||
package dev.plex.command.impl;
|
||||
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.CommandFailException;
|
||||
import dev.plex.command.source.CommandSource;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.ADMIN, source = RequiredCommandSource.IN_GAME)
|
||||
@CommandParameters(description = "Teleport to the flatlands")
|
||||
public class FlatlandsCMD extends PlexCommand
|
||||
@ -34,7 +27,7 @@ public class FlatlandsCMD extends PlexCommand
|
||||
if (args.length == 0)
|
||||
{
|
||||
Location loc = new Location(Bukkit.getWorld("flatlands"), 0, 50, 0);
|
||||
PaperLib.teleportAsync(sender.getPlayer(), loc);
|
||||
sender.getPlayer().teleportAsync(loc);
|
||||
send(tl("teleportedToWorld", "flatlands"));
|
||||
}
|
||||
}
|
||||
|
@ -1,25 +1,24 @@
|
||||
package dev.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
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.CommandArgumentException;
|
||||
import dev.plex.command.source.CommandSource;
|
||||
import dev.plex.player.PunishedPlayer;
|
||||
import dev.plex.punishment.Punishment;
|
||||
import dev.plex.punishment.PunishmentType;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import dev.plex.cache.PlayerCache;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.player.PunishedPlayer;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandParameters(description = "Freeze a player on the server", usage = "/<command> <player>")
|
||||
@CommandPermissions(level = Rank.ADMIN)
|
||||
public class FreezeCMD extends PlexCommand
|
||||
|
@ -1,24 +1,17 @@
|
||||
package dev.plex.command.impl;
|
||||
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.CommandFailException;
|
||||
import dev.plex.command.source.CommandSource;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.ADMIN, source = RequiredCommandSource.IN_GAME)
|
||||
@CommandParameters(aliases = "mbw", description = "Teleport to the Master Builder world")
|
||||
public class MasterbuilderworldCMD extends PlexCommand
|
||||
@ -35,7 +28,7 @@ public class MasterbuilderworldCMD extends PlexCommand
|
||||
if (args.length == 0)
|
||||
{
|
||||
Location loc = new Location(Bukkit.getWorld("masterbuilderworld"), 0, 50, 0);
|
||||
PaperLib.teleportAsync(sender.getPlayer(), loc);
|
||||
sender.getPlayer().teleportAsync(loc);
|
||||
send(tl("teleportedToWorld", "Master Builder world"));
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,22 @@
|
||||
package dev.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.CommandArgumentException;
|
||||
import dev.plex.command.source.CommandSource;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
@CommandParameters(description = "Get the name history of a player", usage = "/<command> <player>", aliases = "nh")
|
||||
@CommandPermissions(level = Rank.OP)
|
||||
public class NameHistoryCMD extends PlexCommand
|
||||
|
@ -1,16 +1,17 @@
|
||||
package dev.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.source.CommandSource;
|
||||
import java.util.List;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@CommandParameters(description = "Op everyone on the server", aliases = "opa")
|
||||
@CommandPermissions(level = Rank.ADMIN)
|
||||
public class OpAllCMD extends PlexCommand
|
||||
|
@ -1,16 +1,17 @@
|
||||
package dev.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.CommandArgumentException;
|
||||
import dev.plex.command.source.CommandSource;
|
||||
import java.util.List;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@CommandParameters(description = "Op a player on the server", usage = "/<command> <player>")
|
||||
@CommandPermissions(level = Rank.OP)
|
||||
public class OpCMD extends PlexCommand
|
||||
|
@ -1,35 +1,53 @@
|
||||
package dev.plex.command.impl;
|
||||
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.CommandArgumentException;
|
||||
import dev.plex.command.source.CommandSource;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = RequiredCommandSource.ANY)
|
||||
@CommandParameters(aliases = "plexhelp", description = "Help with plex")
|
||||
public class PlexCMD extends PlexCommand
|
||||
{
|
||||
public PlexCMD()
|
||||
{
|
||||
@CommandParameters(usage = "/<command> [reload]", aliases = "plexhelp", description = "Show information about Plex or reload it")
|
||||
public class PlexCMD extends PlexCommand {
|
||||
public PlexCMD() {
|
||||
super("plex");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSource sender, String[] args)
|
||||
{
|
||||
public void execute(CommandSource sender, String[] args) {
|
||||
if (args.length == 0) {
|
||||
send(ChatColor.LIGHT_PURPLE + "Plex. The long awaited TotalFreedomMod rewrite starts here...");
|
||||
send(ChatColor.LIGHT_PURPLE + "Plugin version: " + ChatColor.GOLD + "1.0");
|
||||
return;
|
||||
}
|
||||
if (args[0].equals("reload"))
|
||||
{
|
||||
if (!plugin.getRankManager().isSeniorAdmin(sender.getPlexPlayer()))
|
||||
{
|
||||
send(tl("noPermission"));
|
||||
return;
|
||||
}
|
||||
Plex.get().config.load();
|
||||
send("Reloaded config file");
|
||||
Plex.get().messages.load();
|
||||
send("Reloaded messages file");
|
||||
Plex.get().getRankManager().importDefaultRanks();
|
||||
send("Imported ranks");
|
||||
send("Plex successfully reloaded.");
|
||||
} else {
|
||||
throw new CommandArgumentException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSource sender, String[] args)
|
||||
{
|
||||
return Arrays.asList("Telesphoreo", "super", "Taahh");
|
||||
public List<String> onTabComplete(CommandSource sender, String[] args) {
|
||||
return List.of("reload");
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
package dev.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.source.CommandSource;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.menu.PunishmentMenu;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
|
30
src/main/java/dev/plex/command/impl/RankCMD.java
Normal file
30
src/main/java/dev/plex/command/impl/RankCMD.java
Normal file
@ -0,0 +1,30 @@
|
||||
package dev.plex.command.impl;
|
||||
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.source.CommandSource;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// TODO: See ranks of other players
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = RequiredCommandSource.IN_GAME)
|
||||
@CommandParameters(description = "Displays your rank")
|
||||
public class RankCMD extends PlexCommand {
|
||||
public RankCMD() {
|
||||
super("rank");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSource sender, String[] args) {
|
||||
send(tl("yourRank", sender.getPlexPlayer().getRank()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSource sender, String[] args) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,20 +1,20 @@
|
||||
package dev.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.CommandFailException;
|
||||
import dev.plex.command.source.CommandSource;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = Rank.ADMIN, source = RequiredCommandSource.ANY)
|
||||
@CommandParameters(aliases = "gmsp", description = "Set your own or another player's gamemode to spectator mode")
|
||||
public class SpectatorCMD extends PlexCommand
|
||||
|
@ -1,20 +1,20 @@
|
||||
package dev.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.CommandFailException;
|
||||
import dev.plex.command.source.CommandSource;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = RequiredCommandSource.ANY)
|
||||
@CommandParameters(aliases = "gms", description = "Set your own or another player's gamemode to survival mode")
|
||||
public class SurvivalCMD extends PlexCommand
|
||||
|
@ -1,14 +1,15 @@
|
||||
package dev.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.source.CommandSource;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = RequiredCommandSource.ANY)
|
||||
@CommandParameters(aliases = "tst,tast", description = "HELLO")
|
||||
|
@ -1,19 +1,20 @@
|
||||
package dev.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.CommandArgumentException;
|
||||
import dev.plex.command.source.CommandSource;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = RequiredCommandSource.IN_GAME)
|
||||
@CommandParameters(description = "Teleport to a world.", usage = "/<command> <world>")
|
||||
public class WorldCMD extends PlexCommand
|
||||
|
@ -1,8 +1,8 @@
|
||||
package dev.plex.command.source;
|
||||
|
||||
import lombok.Getter;
|
||||
import dev.plex.cache.PlayerCache;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,9 +1,10 @@
|
||||
package dev.plex.config;
|
||||
|
||||
import dev.plex.Plex;
|
||||
import java.io.File;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class Config extends YamlConfiguration
|
||||
{
|
||||
private Plex plugin;
|
||||
|
@ -1,13 +1,14 @@
|
||||
package dev.plex.event;
|
||||
|
||||
import dev.plex.player.PunishedPlayer;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Getter
|
||||
public abstract class PunishedPlayerEvent extends PlayerEvent implements Cancellable
|
||||
{
|
||||
|
@ -1,51 +1,36 @@
|
||||
package dev.plex.handlers;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import dev.plex.command.impl.AdminCMD;
|
||||
import dev.plex.command.impl.AdminworldCMD;
|
||||
import dev.plex.command.impl.AdventureCMD;
|
||||
import dev.plex.command.impl.BanCMD;
|
||||
import dev.plex.command.impl.CreativeCMD;
|
||||
import dev.plex.command.impl.FionnCMD;
|
||||
import dev.plex.command.impl.FlatlandsCMD;
|
||||
import dev.plex.command.impl.FreezeCMD;
|
||||
import dev.plex.command.impl.MasterbuilderworldCMD;
|
||||
import dev.plex.command.impl.NameHistoryCMD;
|
||||
import dev.plex.command.impl.OpAllCMD;
|
||||
import dev.plex.command.impl.OpCMD;
|
||||
import dev.plex.command.impl.PlexCMD;
|
||||
import dev.plex.command.impl.PunishmentsCMD;
|
||||
import dev.plex.command.impl.SpectatorCMD;
|
||||
import dev.plex.command.impl.SurvivalCMD;
|
||||
import dev.plex.command.impl.TestCMD;
|
||||
import dev.plex.command.impl.WorldCMD;
|
||||
import java.util.List;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.impl.*;
|
||||
import dev.plex.util.PlexLog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CommandHandler
|
||||
{
|
||||
public CommandHandler()
|
||||
{
|
||||
List<PlexCommand> commands = Lists.newArrayList();
|
||||
commands.add(new TestCMD());
|
||||
commands.add(new PlexCMD());
|
||||
commands.add(new AdminCMD());
|
||||
commands.add(new AdminworldCMD());
|
||||
commands.add(new AdventureCMD());
|
||||
commands.add(new BanCMD());
|
||||
commands.add(new CreativeCMD());
|
||||
commands.add(new FionnCMD());
|
||||
commands.add(new WorldCMD());
|
||||
commands.add(new FlatlandsCMD());
|
||||
commands.add(new FreezeCMD());
|
||||
commands.add(new MasterbuilderworldCMD());
|
||||
commands.add(new NameHistoryCMD());
|
||||
commands.add(new OpAllCMD());
|
||||
commands.add(new OpCMD());
|
||||
commands.add(new FreezeCMD());
|
||||
commands.add(new NameHistoryCMD());
|
||||
commands.add(new AdminCMD());
|
||||
commands.add(new AdventureCMD());
|
||||
commands.add(new CreativeCMD());
|
||||
commands.add(new SurvivalCMD());
|
||||
commands.add(new SpectatorCMD());
|
||||
commands.add(new BanCMD());
|
||||
commands.add(new PlexCMD());
|
||||
commands.add(new PunishmentsCMD());
|
||||
commands.add(new FlatlandsCMD());
|
||||
commands.add(new AdminworldCMD());
|
||||
commands.add(new MasterbuilderworldCMD());
|
||||
commands.add(new RankCMD());
|
||||
commands.add(new SpectatorCMD());
|
||||
commands.add(new SurvivalCMD());
|
||||
commands.add(new TestCMD());
|
||||
commands.add(new WorldCMD());
|
||||
PlexLog.log(String.format("Registered %s commands!", commands.size()));
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,12 @@
|
||||
package dev.plex.handlers;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import dev.plex.listener.impl.AdminListener;
|
||||
import dev.plex.listener.impl.ChatListener;
|
||||
import dev.plex.listener.impl.FreezeListener;
|
||||
import dev.plex.listener.impl.LoginListener;
|
||||
import dev.plex.listener.impl.PlayerListener;
|
||||
import dev.plex.listener.impl.ServerListener;
|
||||
import dev.plex.listener.impl.WorldListener;
|
||||
import java.util.List;
|
||||
import dev.plex.listener.PlexListener;
|
||||
import dev.plex.listener.impl.*;
|
||||
import dev.plex.util.PlexLog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ListenerHandler
|
||||
{
|
||||
public ListenerHandler()
|
||||
|
@ -6,11 +6,11 @@ import dev.plex.event.AdminSetRankEvent;
|
||||
import dev.plex.listener.PlexListener;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import static dev.plex.util.PlexUtils.tl;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import static dev.plex.util.PlexUtils.tl;
|
||||
|
||||
public class AdminListener extends PlexListener
|
||||
{
|
||||
@EventHandler
|
||||
|
@ -12,7 +12,7 @@ public class LoginListener extends PlexListener
|
||||
@EventHandler
|
||||
public void onPreLogin(AsyncPlayerPreLoginEvent event)
|
||||
{
|
||||
PlexLog.log(String.valueOf(plugin.getBanManager().isBanned(event.getUniqueId())));
|
||||
// PlexLog.log(String.valueOf(plugin.getBanManager().isBanned(event.getUniqueId())));
|
||||
if (plugin.getBanManager().isBanned(event.getUniqueId()))
|
||||
{
|
||||
event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_BANNED, "§cYou're currently banned from this server.\n§cPlease appeal at §6https://forum.telesphoreo.me");
|
||||
|
@ -1,7 +1,5 @@
|
||||
package dev.plex.listener.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
import dev.plex.admin.Admin;
|
||||
import dev.plex.cache.DataUtils;
|
||||
import dev.plex.cache.MongoPlayerData;
|
||||
@ -20,6 +18,9 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PlayerListener extends PlexListener
|
||||
{
|
||||
private final MongoPlayerData mongoPlayerData = plugin.getMongoPlayerData() != null ? plugin.getMongoPlayerData() : null;
|
||||
@ -35,7 +36,7 @@ public class PlayerListener extends PlexListener
|
||||
|
||||
if (!DataUtils.hasPlayedBefore(player.getUniqueId()))
|
||||
{
|
||||
PlexLog.log("AYO THIS MAN DONT EXIST"); // funi msg
|
||||
PlexLog.log("A player with this name has not joined the server before, creating new entry."); // funi msg
|
||||
plexPlayer = new PlexPlayer(player.getUniqueId()); //it doesn't! okay so now create the object
|
||||
plexPlayer.setName(player.getName()); //set the name of the player
|
||||
plexPlayer.setIps(Arrays.asList(player.getAddress().getAddress().getHostAddress().trim())); //set the arraylist of ips
|
||||
|
@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||
|
||||
import static dev.plex.util.PlexUtils.tl;
|
||||
|
||||
public class WorldListener extends PlexListener
|
||||
|
@ -4,16 +4,17 @@ import dev.morphia.annotations.Entity;
|
||||
import dev.morphia.annotations.Id;
|
||||
import dev.morphia.annotations.IndexOptions;
|
||||
import dev.morphia.annotations.Indexed;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity(value = "players", useDiscriminator = false)
|
||||
|
@ -1,7 +1,18 @@
|
||||
package dev.plex.player;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.event.PunishedPlayerFreezeEvent;
|
||||
import dev.plex.event.PunishedPlayerMuteEvent;
|
||||
import dev.plex.punishment.Punishment;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONTokener;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
@ -10,17 +21,6 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import dev.plex.event.PunishedPlayerFreezeEvent;
|
||||
import dev.plex.event.PunishedPlayerMuteEvent;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONTokener;
|
||||
|
||||
@Getter
|
||||
public class PunishedPlayer
|
||||
{
|
||||
|
@ -2,9 +2,10 @@ package dev.plex.rank;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
public class DefaultRankObj
|
||||
{
|
||||
|
@ -3,16 +3,17 @@ package dev.plex.rank;
|
||||
import com.google.common.collect.Maps;
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexLog;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONTokener;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONTokener;
|
||||
|
||||
public class RankManager
|
||||
{
|
||||
@ -99,4 +100,9 @@ public class RankManager
|
||||
{
|
||||
return !plexPlayer.getRank().isEmpty() && plexPlayer.getRankFromString().isAtLeast(Rank.ADMIN);
|
||||
}
|
||||
|
||||
public boolean isSeniorAdmin(PlexPlayer plexPlayer)
|
||||
{
|
||||
return !plexPlayer.getRank().isEmpty() && plexPlayer.getRankFromString().isAtLeast(Rank.SENIOR_ADMIN);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
package dev.plex.rank.enums;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.List;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public enum Rank
|
||||
{
|
||||
IMPOSTOR(-1, ChatColor.AQUA + "an " + ChatColor.YELLOW + "Impostor", ChatColor.YELLOW + "[Imp]"),
|
||||
|
@ -2,14 +2,19 @@ package dev.plex.services;
|
||||
|
||||
public abstract class AbstractService implements IService
|
||||
{
|
||||
|
||||
private boolean asynchronous;
|
||||
private boolean repeating;
|
||||
|
||||
public AbstractService(boolean async)
|
||||
public AbstractService(boolean repeating, boolean async)
|
||||
{
|
||||
this.repeating = repeating;
|
||||
this.asynchronous = async;
|
||||
}
|
||||
|
||||
public boolean isRepeating() {
|
||||
return repeating;
|
||||
}
|
||||
|
||||
public boolean isAsynchronous() {
|
||||
return asynchronous;
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package dev.plex.services;
|
||||
|
||||
public interface IService
|
||||
{
|
||||
|
||||
void run();
|
||||
|
||||
int repeatInSeconds();
|
||||
|
@ -3,42 +3,36 @@ package dev.plex.services;
|
||||
import com.google.common.collect.Lists;
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.services.impl.BanService;
|
||||
import dev.plex.services.impl.GameruleService;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ServiceManager
|
||||
{
|
||||
|
||||
public class ServiceManager {
|
||||
private final List<AbstractService> services = Lists.newArrayList();
|
||||
|
||||
public ServiceManager()
|
||||
{
|
||||
public ServiceManager() {
|
||||
registerService(new BanService());
|
||||
registerService(new GameruleService());
|
||||
}
|
||||
|
||||
public void startServices()
|
||||
{
|
||||
for (AbstractService service : services)
|
||||
{
|
||||
if (service.isAsynchronous())
|
||||
{
|
||||
public void startServices() {
|
||||
for (AbstractService service : services) {
|
||||
if (!service.isRepeating()) {
|
||||
Bukkit.getScheduler().runTask(Plex.get(), service::run);
|
||||
} else if (service.isRepeating() && service.isAsynchronous()) {
|
||||
Bukkit.getScheduler().runTaskTimerAsynchronously(Plex.get(), service::run, 0, 20 * service.repeatInSeconds());
|
||||
} else {
|
||||
} else if (service.isRepeating() && !service.isAsynchronous()) {
|
||||
Bukkit.getScheduler().runTaskTimer(Plex.get(), service::run, 0, 20 * service.repeatInSeconds());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void registerService(AbstractService service)
|
||||
{
|
||||
private void registerService(AbstractService service) {
|
||||
services.add(service);
|
||||
}
|
||||
|
||||
public int serviceCount()
|
||||
{
|
||||
public int serviceCount() {
|
||||
return services.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package dev.plex.services.impl;
|
||||
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.services.AbstractService;
|
||||
import dev.plex.banning.Ban;
|
||||
import dev.plex.services.AbstractService;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.Date;
|
||||
@ -10,7 +10,7 @@ import java.util.Date;
|
||||
public class BanService extends AbstractService
|
||||
{
|
||||
public BanService() {
|
||||
super(true);
|
||||
super(true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
92
src/main/java/dev/plex/services/impl/GameruleService.java
Normal file
92
src/main/java/dev/plex/services/impl/GameruleService.java
Normal file
@ -0,0 +1,92 @@
|
||||
package dev.plex.services.impl;
|
||||
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.services.AbstractService;
|
||||
import dev.plex.util.PlexLog;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GameruleService extends AbstractService {
|
||||
private final Map<GameRule, Boolean> rules = new EnumMap<>(GameRule.class);
|
||||
|
||||
public GameruleService() {
|
||||
super(false, false);
|
||||
}
|
||||
|
||||
public void setGameRule(GameRule gameRule, boolean value) {
|
||||
setGameRule(gameRule, value, true);
|
||||
}
|
||||
|
||||
public void setGameRule(GameRule gameRule, boolean value, boolean doCommit) {
|
||||
rules.put(gameRule, value);
|
||||
if (doCommit) {
|
||||
commitGameRules();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void commitGameRules() {
|
||||
List<World> worlds = Bukkit.getWorlds();
|
||||
for (Map.Entry<GameRule, Boolean> gameRuleEntry : rules.entrySet()) {
|
||||
String gameRuleName = gameRuleEntry.getKey().getGameRuleName();
|
||||
String gameRuleValue = gameRuleEntry.getValue().toString();
|
||||
|
||||
for (World world : worlds) {
|
||||
world.setGameRuleValue(gameRuleName, gameRuleValue);
|
||||
if (gameRuleEntry.getKey() == GameRule.DO_DAYLIGHT_CYCLE && !gameRuleEntry.getValue()) {
|
||||
long time = world.getTime();
|
||||
time -= time % 24000;
|
||||
world.setTime(time + 24000 + 6000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (GameRule gameRule : GameRule.values()) {
|
||||
rules.put(gameRule, gameRule.getDefaultValue());
|
||||
PlexLog.log(gameRule.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int repeatInSeconds() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public enum GameRule {
|
||||
DO_FIRE_TICK("doFireTick", true),
|
||||
MOB_GRIEFING("mobGriefing", true),
|
||||
KEEP_INVENTORY("keepInventory", true),
|
||||
DO_MOB_SPAWNING("doMobSpawning", true),
|
||||
DO_MOB_LOOT("doMobLoot", true),
|
||||
DO_TILE_DROPS("doTileDrops", true),
|
||||
COMMAND_BLOCK_OUTPUT("commandBlockOutput", true),
|
||||
NATURAL_REGENERATION("naturalRegeneration", true),
|
||||
DO_DAYLIGHT_CYCLE("doDaylightCycle", true),
|
||||
ANNOUNCE_ADVANCEMENTS("announceAdvancements", true),
|
||||
SHOW_DEATH_MESSAGES("showDeathMessages", true),
|
||||
SEND_COMMAND_FEEDBACK("sendCommandFeedback", true);
|
||||
|
||||
private final String gameRuleName;
|
||||
private final boolean defaultValue;
|
||||
|
||||
GameRule(String gameRuleName, boolean defaultValue) {
|
||||
this.gameRuleName = gameRuleName;
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public String getGameRuleName() {
|
||||
return gameRuleName;
|
||||
}
|
||||
|
||||
public boolean getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ package dev.plex.storage;
|
||||
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.PlexBase;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
|
@ -3,6 +3,15 @@ package dev.plex.util;
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.config.Config;
|
||||
import dev.plex.storage.StorageType;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.PluginCommandYamlParser;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
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;
|
||||
@ -12,18 +21,6 @@ import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.stream.Collectors;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.PluginCommandYamlParser;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
public class PlexUtils
|
||||
{
|
||||
|
@ -1,9 +1,10 @@
|
||||
package dev.plex.world;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
|
||||
public class BlockMapChunkGenerator extends FlatChunkGenerator
|
||||
{
|
||||
|
@ -1,10 +1,11 @@
|
||||
package dev.plex.world;
|
||||
|
||||
import dev.plex.Plex;
|
||||
import java.util.LinkedHashMap;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
public class ConfigurationChunkGenerator extends BlockMapChunkGenerator
|
||||
{
|
||||
private static final Plex plugin = Plex.get();
|
||||
|
@ -1,11 +1,12 @@
|
||||
package dev.plex.world;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class CustomChunkGenerator extends ChunkGenerator
|
||||
{
|
||||
protected int height;
|
||||
|
@ -1,8 +1,6 @@
|
||||
package dev.plex.world;
|
||||
|
||||
import dev.plex.Plex;
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
@ -11,6 +9,9 @@ import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
|
||||
public class CustomWorld extends WorldCreator
|
||||
{
|
||||
private static final Plex plugin = Plex.get();
|
||||
|
@ -1,9 +1,10 @@
|
||||
package dev.plex.world;
|
||||
|
||||
import java.util.Random;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class FlatChunkGenerator extends CustomChunkGenerator
|
||||
{
|
||||
public FlatChunkGenerator(int height, BlockPopulator... populators)
|
||||
|
@ -1,10 +1,11 @@
|
||||
package dev.plex.world;
|
||||
|
||||
import java.util.Random;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
import org.bukkit.util.noise.PerlinNoiseGenerator;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class NoiseChunkGenerator extends CustomChunkGenerator
|
||||
{
|
||||
private final NoiseOptions options;
|
||||
|
@ -1,10 +1,11 @@
|
||||
package dev.plex.world;
|
||||
|
||||
import java.util.Random;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
import org.bukkit.util.noise.PerlinOctaveGenerator;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class OctaveChunkGenerator extends CustomChunkGenerator
|
||||
{
|
||||
private final OctaveOptions options;
|
||||
|
@ -19,49 +19,50 @@ errorColor: "c"
|
||||
# Broadcast color <b> - this will make the color of the message the broadcast color defined above.
|
||||
# Error color <e> - this will make the color of the message the error color defined above.
|
||||
|
||||
test: this is a test message!
|
||||
test: "this is a test message!"
|
||||
# 1: the command sender's username
|
||||
variableTest: variable test with <v>!
|
||||
playerNotFound: Player not found!
|
||||
worldNotFound: World not found!
|
||||
noAdminWorldBlockPlace: <e>You are not allowed to place blocks in the admin world!
|
||||
noAdminWorldBlockBreak: <e>You are not allowed to break blocks in the admin world!
|
||||
variableTest: "variable test with <v>!"
|
||||
playerNotFound: "Player not found!"
|
||||
worldNotFound: "World not found!"
|
||||
noAdminWorldBlockPlace: "<e>You are not allowed to place blocks in the admin world!"
|
||||
noAdminWorldBlockBreak: "<e>You are not allowed to break blocks in the admin world!"
|
||||
# 1: the world you have been teleported to
|
||||
playerWorldTeleport: You have been teleported to <v>.
|
||||
playerWorldTeleport: "You have been teleported to <v>."
|
||||
# 1: the command sender who opped everyone
|
||||
oppedAllPlayers: <b><v> - Opped all players on the server
|
||||
oppedAllPlayers: "<b><v> - Opped all players on the server"
|
||||
# 1: the person who is opping
|
||||
# 2: the person who has been opped
|
||||
oppedPlayer: <b><v> - Opped <v>
|
||||
oppedPlayer: "<b><v> - Opped <v>"
|
||||
# 1: the person who is freezing
|
||||
# 2: the person who has been frozen
|
||||
frozePlayer: <b><v> - Froze <v>
|
||||
frozePlayer: "<b><v> - Froze <v>"
|
||||
# 1: the person who is unfreezing
|
||||
# 2: the person who has been unfrozen
|
||||
unfrozePlayer: <b><v> - Unfroze <v>
|
||||
noPermission: <e>You cannot use this command!
|
||||
unfrozePlayer: "<b><v> - Unfroze <v>"
|
||||
noPermission: "<e>You cannot use this command!"
|
||||
# 1: the login message (uncolored) of the rank required to use the command
|
||||
noPermissionRank: <e>You must be at least <v> rank to use this command!
|
||||
noPermissionInGame: <e>You must be in console to use this command!
|
||||
noPermissionConsole: <e>You must be in-game to use this command!
|
||||
noPermissionRank: "<e>You must be at least <v> rank to use this command!"
|
||||
noPermissionInGame: "<e>You must be in console to use this command!"
|
||||
noPermissionConsole: "<e>You must be in-game to use this command!"
|
||||
# 1: the username of the name history
|
||||
nameHistoryTitle: Name History of <v>
|
||||
nameHistoryTitle: "Name History of <v>"
|
||||
# 1: a username of the found user
|
||||
# 2: when the user changed to that username
|
||||
nameHistoryBody: " - <v> (<v>)"
|
||||
# 1: the username that failed
|
||||
nameHistoryFail: <e>Something went wrong while trying to retrieve name history of <v>! Try again later!
|
||||
gameModeSetTo: Your gamemode has been set to <v>.
|
||||
setOtherPlayerGameModeTo: You set <v>'s gamemode to <v>.
|
||||
playerSetOtherGameMode: <v> set your gamemode to <v>.
|
||||
consoleMustDefinePlayer: You must define a player since you are running this command from console.
|
||||
newAdminAdded: <b><v> - Adding <v> to the admin list
|
||||
adminRemoved: <c><v> - Removing <v> from the admin list
|
||||
adminSetRank: <b><v> - Setting <v>'s rank to <v>
|
||||
teleportedToWorld: <b>You have been teleported to the <v>.
|
||||
higherRankThanYou: <b>This player is an admin and a higher rank than you.
|
||||
playerNotAdmin: <b>That player is not an admin.
|
||||
playerIsAdmin: <b>That player is already an admin.
|
||||
rankNotFound: <b>The rank you entered was not found.
|
||||
rankMustBeHigherThanAdmin: <b>The rank you entered must be higher than Admin.
|
||||
consoleOnly: <b>This command can only be executed by the console.
|
||||
nameHistoryFail: "<e>Something went wrong while trying to retrieve name history of <v>! Try again later!"
|
||||
gameModeSetTo: "Your gamemode has been set to <v>."
|
||||
setOtherPlayerGameModeTo: "You set <v>'s gamemode to <v>."
|
||||
playerSetOtherGameMode: "<v> set your gamemode to <v>."
|
||||
consoleMustDefinePlayer: "You must define a player since you are running this command from console."
|
||||
newAdminAdded: "<b><v> - Adding <v> to the admin list"
|
||||
adminRemoved: "<c><v> - Removing <v> from the admin list"
|
||||
adminSetRank: "<b><v> - Setting <v>'s rank to <v>"
|
||||
teleportedToWorld: "<b>You have been teleported to the <v>."
|
||||
higherRankThanYou: "<b>This player is an admin and a higher rank than you."
|
||||
playerNotAdmin: "<b>That player is not an admin."
|
||||
playerIsAdmin: "<b>That player is already an admin."
|
||||
rankNotFound: "<b>The rank you entered was not found."
|
||||
rankMustBeHigherThanAdmin: "<b>The rank you entered must be higher than Admin."
|
||||
consoleOnly: "<b>This command can only be executed by the console."
|
||||
yourRank: "<b>Your rank is: <v>"
|
Loading…
Reference in New Issue
Block a user