Updates and 1.16 (#50)

Add portal setup config

Signed-off-by: Etzelia <etzelia@hotmail.com>

Updates and 1.16

Signed-off-by: Etzelia <etzelia@hotmail.com>

Reviewed-on: https://git.etztech.xyz/Minecraft/QoL/pulls/50
Reviewed-by: ZeroHD <joey@ahines.net>
up
Etzelia 2020-07-09 16:42:58 +02:00
parent 13ce2096f8
commit 118524e171
32 changed files with 76 additions and 207 deletions

10
pom.xml
View File

@ -29,9 +29,9 @@
<dependencies>
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -59,8 +59,8 @@
<repositories>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
<repository>
<id>etztech-repo</id>

View File

@ -45,7 +45,6 @@ public class QoL extends JavaPlugin {
private static List<String> audits = new ArrayList<>();
private static List<LinkCommand> links = new ArrayList<>();
private static Map<String, Integer> viewDistances = new HashMap<>();
private GriefAlert griefAlert;
public void onEnable() {
@ -90,73 +89,39 @@ public class QoL extends JavaPlugin {
if( isEnabled() ) {
// Add listeners
ServerListPingListener serverListPingListener = new ServerListPingListener(this);
getServer().getPluginManager().registerEvents(serverListPingListener, this);
AsyncPlayerChatListener asyncPlayerChatListener = new AsyncPlayerChatListener(this);
getServer().getPluginManager().registerEvents(asyncPlayerChatListener, this);
LoginListener loginListener = new LoginListener(this);
getServer().getPluginManager().registerEvents(loginListener, this);
JoinListener joinListener = new JoinListener(this);
getServer().getPluginManager().registerEvents(joinListener, this);
BlockIgniteListener blockIgniteListener = new BlockIgniteListener(this);
getServer().getPluginManager().registerEvents(blockIgniteListener, this);
CommandPreprocessListener commandPreprocessListener = new CommandPreprocessListener(this);
getServer().getPluginManager().registerEvents(commandPreprocessListener, this);
DeathListener deathListener = new DeathListener(this);
getServer().getPluginManager().registerEvents(deathListener, this);
PlayerBucketEmptyListener playerBucketEmptyListener = new PlayerBucketEmptyListener(this);
getServer().getPluginManager().registerEvents(playerBucketEmptyListener, this);
BlockPlaceListener blockPlaceListener = new BlockPlaceListener(this);
getServer().getPluginManager().registerEvents(blockPlaceListener, this);
PlayerChangedWorldListener playerChangedWorldListener = new PlayerChangedWorldListener(this);
getServer().getPluginManager().registerEvents(playerChangedWorldListener, this);
new ServerListPingListener(this);
new AsyncPlayerChatListener(this);
new LoginListener(this);
new JoinListener(this);
new BlockIgniteListener(this);
new CommandPreprocessListener(this);
new DeathListener(this);
new PlayerBucketEmptyListener(this);
new BlockPlaceListener(this);
new PlayerChangedWorldListener(this);
// Add commands
MainCommand mainCommand = new MainCommand(this);
this.getCommand("qol").setExecutor(mainCommand);
UUIDCommand uuidCommand = new UUIDCommand(this);
this.getCommand("uuid").setExecutor(uuidCommand);
NameHistoryCommand nameHistoryCommand = new NameHistoryCommand(this);
this.getCommand("history").setExecutor(nameHistoryCommand);
PortalCommand portalCommand = new PortalCommand(this);
this.getCommand("portal").setExecutor(portalCommand);
SudoCommand sudoCommand = new SudoCommand(this);
this.getCommand("sudo").setExecutor(sudoCommand);
MakeMeCommand makeMeCommand = new MakeMeCommand(this);
this.getCommand("makeme").setExecutor(makeMeCommand);
ShadowMuteCommand shadowMuteCommand = new ShadowMuteCommand(this);
this.getCommand("shadowmute").setExecutor(shadowMuteCommand);
WhitelistCommand whitelistCommand = new WhitelistCommand(this);
this.getCommand("whitelist").setExecutor(whitelistCommand);
TimeoutCommand timeoutCommand = new TimeoutCommand(this);
this.getCommand("timeout").setExecutor(timeoutCommand);
ColorsCommand colorsCommand = new ColorsCommand(this);
this.getCommand("colors").setExecutor(colorsCommand);
WorldInfoCommand worldInfoCommand = new WorldInfoCommand(this);
this.getCommand("worldinfo").setExecutor(worldInfoCommand);
DeathMuteCommand deathMuteCommand = new DeathMuteCommand(this);
this.getCommand("deathmute").setExecutor(deathMuteCommand);
KaratTrophyCommand karatTrophyCommand = new KaratTrophyCommand(this);
this.getCommand("karattrophy").setExecutor(karatTrophyCommand);
CheckupCommand checkupCommand = new CheckupCommand(this);
this.getCommand("checkup").setExecutor(checkupCommand);
DynmapLinkCommand dynmapLinkCommand = new DynmapLinkCommand(this);
this.getCommand("dynmaplink").setExecutor(dynmapLinkCommand);
new MainCommand(this);
new UUIDCommand(this);
new NameHistoryCommand(this);
new PortalCommand(this);
new SudoCommand(this);
new MakeMeCommand(this);
new ShadowMuteCommand(this);
new WhitelistCommand(this);
new TimeoutCommand(this);
new ColorsCommand(this);
new WorldInfoCommand(this);
new DeathMuteCommand(this);
new CheckupCommand(this);
new DynmapLinkCommand(this);
if (dynmap != null) {
MarkerCommand markerCommand = new MarkerCommand(this);
this.getCommand("marker").setExecutor(markerCommand);
this.getCommand("marker").setTabCompleter(markerCommand);
new MarkerCommand(this);
}
if (getConfig().getStringList("list").size() > 0) {
ListCommand listCommand = new ListCommand(this);
this.getCommand("list").setExecutor(listCommand);
}
if (getConfig().getStringList("plugins").size() > 0) {
PluginsCommand pluginsCommand = new PluginsCommand(this);
this.getCommand("plugins").setExecutor(pluginsCommand);
new ListCommand(this);
}
@ -223,17 +188,6 @@ public class QoL extends JavaPlugin {
links.add(LinkCommand.fromString(raw));
}
viewDistances = new HashMap<>();
ConfigurationSection view_distances = config.getConfigurationSection("view-distances");
for (String worldName : view_distances.getKeys(false)) {
int viewDistance = view_distances.getInt(worldName);
viewDistances.put(worldName, viewDistance);
}
qolMarkerIcon = config.getString("dynmap.marker_icon", "blueflag");
qolMarkerLayerShow = config.getBoolean("dynmap.marker_set_show", false);
qolMarkerSetLabel = config.getString("dynmap.marker_set_label", "QoL Markers");
@ -341,18 +295,10 @@ public class QoL extends JavaPlugin {
return griefAlert;
}
public static Map<String, Integer> getViewDistances() {
return viewDistances;
}
public void runTask(final String command) {
Bukkit.getScheduler().runTask(QoL.instance, () -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command));
}
public void updatePlayerViewDistance(Player player) {
//player.setViewDistance(viewDistances.getOrDefault(player.getWorld().getName().toLowerCase(), getServer().getViewDistance()));
}
public MarkerSet getPlayerMarkerSet() {
return playerMarkerSet;
}

View File

@ -22,9 +22,9 @@ public class CheckupCommand implements CommandExecutor {
QoL plugin;
private static HashMap<UUID, Checkup> checkups = new HashMap<>();
public CheckupCommand(QoL paramQoL)
{
public CheckupCommand(QoL paramQoL) {
this.plugin = paramQoL;
plugin.getCommand("checkup").setExecutor(this);
}
public static void join(Player player) {

View File

@ -12,6 +12,7 @@ public class ColorsCommand implements CommandExecutor {
public ColorsCommand(QoL plugin) {
this.plugin = plugin;
plugin.getCommand("colors").setExecutor(this);
}
@Override

View File

@ -14,9 +14,9 @@ public class DeathMuteCommand implements CommandExecutor {
QoL plugin;
public DeathMuteCommand(QoL paramQoL)
{
public DeathMuteCommand(QoL paramQoL) {
this.plugin = paramQoL;
plugin.getCommand("deathmute").setExecutor(this);
}
@Override

View File

@ -18,6 +18,7 @@ public class DynmapLinkCommand implements CommandExecutor {
public DynmapLinkCommand(QoL plugin) {
this.plugin = plugin;
plugin.getCommand("dynmaplink").setExecutor(this);
}
@Override

View File

@ -1,50 +0,0 @@
package xyz.etztech.qol.commands;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.advancement.Advancement;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.NamespacedKey;
import xyz.etztech.qol.EtzTechUtil;
import xyz.etztech.qol.Lang;
import xyz.etztech.qol.QoL;
public class KaratTrophyCommand implements CommandExecutor {
QoL plugin;
public KaratTrophyCommand(QoL plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String args[]) {
if (!commandSender.hasPermission("qol.karattrophy")) {
EtzTechUtil.sms(commandSender, Lang.NO_PERMISSION.getDef());
return true;
}
Player argPlayer = Bukkit.getPlayer(args[0]);
if (argPlayer == null) {
EtzTechUtil.sms(commandSender, ChatColor.RED + "No player found.");
return true;
}
final Player player = argPlayer;
Advancement adv = Bukkit.getAdvancement(new NamespacedKey("carrotcraft", "24_karat_trophy"));
if (!player.getAdvancementProgress(adv).isDone()) {
EtzTechUtil.sms(commandSender, ChatColor.GREEN + "Awarding 24 Karat Trophy to " + player.getName());
player.getAdvancementProgress(adv).awardCriteria("win");
} else {
EtzTechUtil.sms(commandSender, ChatColor.RED + player.getName() + " already has the 24 Karat Trophy");
}
return true;
}
}

View File

@ -17,6 +17,7 @@ public class ListCommand implements CommandExecutor {
public ListCommand(QoL plugin) {
this.plugin = plugin;
plugin.getCommand("list").setExecutor(this);
}
@Override

View File

@ -15,9 +15,9 @@ public class MainCommand implements CommandExecutor {
QoL plugin;
public MainCommand(QoL paramQoL)
{
public MainCommand(QoL paramQoL) {
this.plugin = paramQoL;
plugin.getCommand("qol").setExecutor(this);
}
@Override

View File

@ -15,9 +15,9 @@ public class MakeMeCommand implements CommandExecutor {
QoL plugin;
public MakeMeCommand(QoL paramQoL)
{
public MakeMeCommand(QoL paramQoL) {
this.plugin = paramQoL;
plugin.getCommand("makeme").setExecutor(this);
}
@Override

View File

@ -21,9 +21,10 @@ public class MarkerCommand implements CommandExecutor, TabExecutor{
QoL plugin;
List<String> subCommandList = Arrays.asList("set", "remove", "list");
public MarkerCommand(QoL paramQoL)
{
public MarkerCommand(QoL paramQoL) {
this.plugin = paramQoL;
plugin.getCommand("marker").setExecutor(this);
plugin.getCommand("marker").setTabCompleter(this);
}
@Override

View File

@ -24,9 +24,9 @@ public class NameHistoryCommand implements CommandExecutor {
QoL plugin;
public NameHistoryCommand(QoL paramQoL)
{
public NameHistoryCommand(QoL paramQoL) {
this.plugin = paramQoL;
plugin.getCommand("history").setExecutor(this);
}
@Override

View File

@ -1,27 +0,0 @@
package xyz.etztech.qol.commands;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import xyz.etztech.qol.QoL;
public class PluginsCommand implements CommandExecutor {
QoL plugin;
public PluginsCommand(QoL plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
commandSender.sendMessage(ChatColor.GOLD + "Plugins: " + ChatColor.YELLOW +
StringUtils.join(plugin.getConfig().getStringList("plugins"), ", "));
return true;
}
}

View File

@ -18,9 +18,9 @@ public class PortalCommand implements CommandExecutor {
QoL plugin;
public PortalCommand(QoL paramQoL)
{
public PortalCommand(QoL paramQoL) {
this.plugin = paramQoL;
plugin.getCommand("portal").setExecutor(this);
}
@Override
@ -60,9 +60,9 @@ public class PortalCommand implements CommandExecutor {
message.append("\n" + ChatColor.GREEN + "Location in the " + worldStr + ": " + newX + ", " + y + ", " + newZ);
EtzTechUtil.sms(commandSender, message.toString());
// Send link to image for setting up nether portal
// Send link to instructions for setting up nether portal
TextComponent link = new TextComponent(ChatColor.GREEN + "Click here for directions on how to set up a nether portal.");
link.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://i.imgur.com/tQCbI0C.png"));
link.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, plugin.getConfig().getString("portal-link", "https://i.imgur.com/tQCbI0C.png")));
commandSender.spigot().sendMessage(link);
return true;

View File

@ -16,9 +16,9 @@ public class ShadowMuteCommand implements CommandExecutor {
QoL plugin;
public ShadowMuteCommand(QoL paramQoL)
{
public ShadowMuteCommand(QoL paramQoL) {
this.plugin = paramQoL;
plugin.getCommand("shadowmute").setExecutor(this);
}
@Override

View File

@ -16,9 +16,9 @@ public class SudoCommand implements CommandExecutor {
QoL plugin;
public SudoCommand(QoL paramQoL)
{
public SudoCommand(QoL paramQoL) {
this.plugin = paramQoL;
plugin.getCommand("sudo").setExecutor(this);
}
@Override

View File

@ -20,9 +20,9 @@ public class TimeoutCommand implements CommandExecutor {
QoL plugin;
public TimeoutCommand(QoL paramQoL)
{
public TimeoutCommand(QoL paramQoL) {
this.plugin = paramQoL;
plugin.getCommand("timeout").setExecutor(this);
}
@Override

View File

@ -23,9 +23,9 @@ public class UUIDCommand implements CommandExecutor {
QoL plugin;
public UUIDCommand(QoL paramQoL)
{
public UUIDCommand(QoL paramQoL) {
this.plugin = paramQoL;
plugin.getCommand("uuid").setExecutor(this);
}
@Override

View File

@ -20,9 +20,9 @@ public class WhitelistCommand implements CommandExecutor {
QoL plugin;
public WhitelistCommand(QoL paramQoL)
{
public WhitelistCommand(QoL paramQoL) {
this.plugin = paramQoL;
plugin.getCommand("whitelist").setExecutor(this);
}
@Override

View File

@ -20,6 +20,7 @@ public class WorldInfoCommand implements CommandExecutor {
public WorldInfoCommand(QoL plugin) {
this.plugin = plugin;
plugin.getCommand("worldinfo").setExecutor(this);
}
@Override

View File

@ -27,6 +27,7 @@ public class AsyncPlayerChatListener implements Listener {
public AsyncPlayerChatListener(QoL plugin) {
this.plugin = plugin;
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler(priority=EventPriority.HIGH, ignoreCancelled=true)

View File

@ -11,6 +11,7 @@ public class BlockIgniteListener implements Listener {
public BlockIgniteListener(QoL plugin) {
this.plugin = plugin;
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler

View File

@ -14,6 +14,7 @@ public class BlockPlaceListener implements Listener {
public BlockPlaceListener(QoL plugin) {
this.plugin = plugin;
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler

View File

@ -25,6 +25,7 @@ public class CommandPreprocessListener implements Listener {
public CommandPreprocessListener(QoL plugin) {
this.plugin = plugin;
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler

View File

@ -21,6 +21,7 @@ public class DeathListener implements Listener {
public DeathListener(QoL plugin) {
this.plugin = plugin;
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler

View File

@ -20,6 +20,7 @@ public class JoinListener implements Listener {
public JoinListener(QoL plugin) {
this.plugin = plugin;
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler

View File

@ -14,6 +14,7 @@ public class LoginListener implements Listener {
public LoginListener(QoL plugin) {
this.plugin = plugin;
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler

View File

@ -14,6 +14,7 @@ public class PlayerBucketEmptyListener implements Listener {
public PlayerBucketEmptyListener(QoL plugin) {
this.plugin = plugin;
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler

View File

@ -13,6 +13,7 @@ public class PlayerChangedWorldListener implements Listener {
public PlayerChangedWorldListener(QoL plugin) {
this.plugin = plugin;
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler

View File

@ -21,6 +21,7 @@ public class ServerListPingListener implements Listener {
public ServerListPingListener(QoL plugin) {
this.plugin = plugin;
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler

View File

@ -19,11 +19,6 @@ list:
# - mod
# - member
# A list of plugins to show, overriding the Vanilla /pl
# Leave blank to disable
plugins:
# - QoL
# A list of permissions to check, followed by a list of commands to run on login if a player has the specified permission
# Special variables are <player> for the player logging in
queue:
@ -52,6 +47,9 @@ grief-alert:
lines: 5
webhook: ''
# The link to open for portal setup instructions
portal-link: 'https://i.imgur.com/tQCbI0C.png'
# The range after which a player will be marked as "outside the border"
worldinfo:
world: 5000
@ -90,10 +88,6 @@ disable-fire:
ender_crystal: false
explosion: false
# Overrides view distance per world, format is [World Name]: [View Distance]
view-distances:
world: 2
# A list of commands to confirm before using if the user isn't in spectator mode
spec-confirm:
- "tp"

View File

@ -13,9 +13,6 @@ commands:
list:
description: See a list of players
aliases: [players, playerlist]
plugins:
description: See a list of plugins
aliases: [pl]
history:
description: Name History utility command
aliases: [names, name]
@ -40,9 +37,6 @@ commands:
description: Whitelist command
timeout:
description: Timeout command
karattrophy:
description: 24 karat trophy command
aliases: [trophy]
checkup:
description: Checkup command
dynmaplink:
@ -85,9 +79,6 @@ permissions:
qol.deathmute:
description: Ability to use the Death Mute command
default: op
qol.karattrophy:
description: Ability to use the Karat Trophy Command
default: op
qol.checkup:
description: Ability to use the Checkup Command
default: op