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

View File

@ -44,8 +44,7 @@ public class QoL extends JavaPlugin {
private static boolean timeout = false; private static boolean timeout = false;
private static List<String> audits = new ArrayList<>(); private static List<String> audits = new ArrayList<>();
private static List<LinkCommand> links = new ArrayList<>(); private static List<LinkCommand> links = new ArrayList<>();
private static Map<String, Integer> viewDistances = new HashMap<>();
private GriefAlert griefAlert; private GriefAlert griefAlert;
public void onEnable() { public void onEnable() {
@ -90,73 +89,39 @@ public class QoL extends JavaPlugin {
if( isEnabled() ) { if( isEnabled() ) {
// Add listeners // Add listeners
ServerListPingListener serverListPingListener = new ServerListPingListener(this); new ServerListPingListener(this);
getServer().getPluginManager().registerEvents(serverListPingListener, this); new AsyncPlayerChatListener(this);
AsyncPlayerChatListener asyncPlayerChatListener = new AsyncPlayerChatListener(this); new LoginListener(this);
getServer().getPluginManager().registerEvents(asyncPlayerChatListener, this); new JoinListener(this);
LoginListener loginListener = new LoginListener(this); new BlockIgniteListener(this);
getServer().getPluginManager().registerEvents(loginListener, this); new CommandPreprocessListener(this);
JoinListener joinListener = new JoinListener(this); new DeathListener(this);
getServer().getPluginManager().registerEvents(joinListener, this); new PlayerBucketEmptyListener(this);
BlockIgniteListener blockIgniteListener = new BlockIgniteListener(this); new BlockPlaceListener(this);
getServer().getPluginManager().registerEvents(blockIgniteListener, this); new PlayerChangedWorldListener(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);
// Add commands // Add commands
MainCommand mainCommand = new MainCommand(this); new MainCommand(this);
this.getCommand("qol").setExecutor(mainCommand); new UUIDCommand(this);
UUIDCommand uuidCommand = new UUIDCommand(this); new NameHistoryCommand(this);
this.getCommand("uuid").setExecutor(uuidCommand); new PortalCommand(this);
NameHistoryCommand nameHistoryCommand = new NameHistoryCommand(this); new SudoCommand(this);
this.getCommand("history").setExecutor(nameHistoryCommand); new MakeMeCommand(this);
PortalCommand portalCommand = new PortalCommand(this); new ShadowMuteCommand(this);
this.getCommand("portal").setExecutor(portalCommand); new WhitelistCommand(this);
SudoCommand sudoCommand = new SudoCommand(this); new TimeoutCommand(this);
this.getCommand("sudo").setExecutor(sudoCommand); new ColorsCommand(this);
MakeMeCommand makeMeCommand = new MakeMeCommand(this); new WorldInfoCommand(this);
this.getCommand("makeme").setExecutor(makeMeCommand); new DeathMuteCommand(this);
ShadowMuteCommand shadowMuteCommand = new ShadowMuteCommand(this); new CheckupCommand(this);
this.getCommand("shadowmute").setExecutor(shadowMuteCommand); new DynmapLinkCommand(this);
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);
if (dynmap != null) { if (dynmap != null) {
MarkerCommand markerCommand = new MarkerCommand(this); new MarkerCommand(this);
this.getCommand("marker").setExecutor(markerCommand);
this.getCommand("marker").setTabCompleter(markerCommand);
} }
if (getConfig().getStringList("list").size() > 0) { if (getConfig().getStringList("list").size() > 0) {
ListCommand listCommand = new ListCommand(this); new ListCommand(this);
this.getCommand("list").setExecutor(listCommand);
}
if (getConfig().getStringList("plugins").size() > 0) {
PluginsCommand pluginsCommand = new PluginsCommand(this);
this.getCommand("plugins").setExecutor(pluginsCommand);
} }
@ -223,17 +188,6 @@ public class QoL extends JavaPlugin {
links.add(LinkCommand.fromString(raw)); 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"); qolMarkerIcon = config.getString("dynmap.marker_icon", "blueflag");
qolMarkerLayerShow = config.getBoolean("dynmap.marker_set_show", false); qolMarkerLayerShow = config.getBoolean("dynmap.marker_set_show", false);
qolMarkerSetLabel = config.getString("dynmap.marker_set_label", "QoL Markers"); qolMarkerSetLabel = config.getString("dynmap.marker_set_label", "QoL Markers");
@ -341,18 +295,10 @@ public class QoL extends JavaPlugin {
return griefAlert; return griefAlert;
} }
public static Map<String, Integer> getViewDistances() {
return viewDistances;
}
public void runTask(final String command) { public void runTask(final String command) {
Bukkit.getScheduler().runTask(QoL.instance, () -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), 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() { public MarkerSet getPlayerMarkerSet() {
return playerMarkerSet; return playerMarkerSet;
} }

View File

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

View File

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

View File

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

View File

@ -18,6 +18,7 @@ public class DynmapLinkCommand implements CommandExecutor {
public DynmapLinkCommand(QoL plugin) { public DynmapLinkCommand(QoL plugin) {
this.plugin = plugin; this.plugin = plugin;
plugin.getCommand("dynmaplink").setExecutor(this);
} }
@Override @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) { public ListCommand(QoL plugin) {
this.plugin = plugin; this.plugin = plugin;
plugin.getCommand("list").setExecutor(this);
} }
@Override @Override

View File

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

View File

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

View File

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

View File

@ -24,9 +24,9 @@ public class NameHistoryCommand implements CommandExecutor {
QoL plugin; QoL plugin;
public NameHistoryCommand(QoL paramQoL) public NameHistoryCommand(QoL paramQoL) {
{
this.plugin = paramQoL; this.plugin = paramQoL;
plugin.getCommand("history").setExecutor(this);
} }
@Override @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; QoL plugin;
public PortalCommand(QoL paramQoL) public PortalCommand(QoL paramQoL) {
{
this.plugin = paramQoL; this.plugin = paramQoL;
plugin.getCommand("portal").setExecutor(this);
} }
@Override @Override
@ -60,9 +60,9 @@ public class PortalCommand implements CommandExecutor {
message.append("\n" + ChatColor.GREEN + "Location in the " + worldStr + ": " + newX + ", " + y + ", " + newZ); message.append("\n" + ChatColor.GREEN + "Location in the " + worldStr + ": " + newX + ", " + y + ", " + newZ);
EtzTechUtil.sms(commandSender, message.toString()); 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."); 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); commandSender.spigot().sendMessage(link);
return true; return true;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,11 +19,6 @@ list:
# - mod # - mod
# - member # - 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 # 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 # Special variables are <player> for the player logging in
queue: queue:
@ -52,6 +47,9 @@ grief-alert:
lines: 5 lines: 5
webhook: '' 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" # The range after which a player will be marked as "outside the border"
worldinfo: worldinfo:
world: 5000 world: 5000
@ -90,10 +88,6 @@ disable-fire:
ender_crystal: false ender_crystal: false
explosion: 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 # A list of commands to confirm before using if the user isn't in spectator mode
spec-confirm: spec-confirm:
- "tp" - "tp"

View File

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