forked from Minecraft/QoL
Compare commits
31 Commits
Author | SHA1 | Date |
---|---|---|
Mighty_Squid | d1f6eb6b95 | |
benamaurer | 0cfb7582bf | |
Joey Hines | 0c08c26854 | |
Joey Hines | f327f59d6c | |
Mighty_Squid | df292f88c5 | |
Joey Hines | fa2f79239e | |
Mighty_Squid | 2e72736571 | |
Joey Hines | 3c54c249a1 | |
Joey Hines | 3ae415d7d0 | |
Joey Hines | e3cf0d6d9f | |
Joey Hines | 3c3fdc1725 | |
Joey Hines | 9c316f9fff | |
Joey Hines | e91e5ae9e5 | |
Joey Hines | 684b269039 | |
Joey Hines | fc163baf51 | |
Joey Hines | c9434b916e | |
Etzelia | 2bc9733955 | |
Joey Hines | cc11677a18 | |
Joey Hines | 7f7c00e22b | |
Joey Hines | 07a69eb279 | |
Etzelia | 118524e171 | |
Joey Hines | 13ce2096f8 | |
Etz Elia | 2136c712f2 | |
Joey Hines | 6a746d5702 | |
Joey Hines | e75d8efdfc | |
Etzelia | d55fb1112a | |
Etzelia | ee0867d5cc | |
Etzelia | 6d73df72a3 | |
Etzelia | 8d0e30cfa3 | |
Etzelia | 253402f4fe | |
Etzelia | af7abe9ca7 |
|
@ -0,0 +1,36 @@
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: compliance
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build
|
||||||
|
image: maven:3-openjdk-16
|
||||||
|
commands:
|
||||||
|
- mvn install
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: release
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build
|
||||||
|
image: maven:3-openjdk-16
|
||||||
|
commands:
|
||||||
|
- mvn install
|
||||||
|
- name: gitea-release
|
||||||
|
pull: always
|
||||||
|
image: jolheiser/drone-gitea-main:latest
|
||||||
|
settings:
|
||||||
|
token:
|
||||||
|
from_secret: gitea_token
|
||||||
|
base: https://git.canopymc.net
|
||||||
|
files:
|
||||||
|
- "target/QoL-*.jar"
|
|
@ -0,0 +1,7 @@
|
||||||
|
Copyright 2020 Etzelia
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -13,3 +13,5 @@ Changelogs
|
||||||
v1.5 <v1.5>
|
v1.5 <v1.5>
|
||||||
v1.6 <v1.6>
|
v1.6 <v1.6>
|
||||||
v1.7 <v1.7>
|
v1.7 <v1.7>
|
||||||
|
v1.8 <v1.8>
|
||||||
|
v1.9 <1.9>
|
|
@ -13,3 +13,4 @@ Additions
|
||||||
|
|
||||||
Bug Fixes
|
Bug Fixes
|
||||||
---------
|
---------
|
||||||
|
None
|
|
@ -0,0 +1,30 @@
|
||||||
|
.. include:: ../common.rst
|
||||||
|
|
||||||
|
.. _qol_v1.8:
|
||||||
|
|
||||||
|
QoL v1.8
|
||||||
|
========
|
||||||
|
|
||||||
|
Additions
|
||||||
|
---------
|
||||||
|
* `Checkup Command`_ - Allows a user to start a checkup, teleporting to each online player
|
||||||
|
* `Discord Syntax`_ - Allows a user to use Discord (markdown) syntax for chat formatting
|
||||||
|
|
||||||
|
``_italic_`` |br|
|
||||||
|
``*italic*`` |br|
|
||||||
|
``__underline__`` |br|
|
||||||
|
``**bold**`` |br|
|
||||||
|
``~~strikethrough~~``
|
||||||
|
|
||||||
|
* `Spec Confirm`_ - Updates the TP confirmation to allow for a configurable list of commands
|
||||||
|
* `Dynmap Link Command`_ - Allows a user to get a link to dynmap pointing to their current location
|
||||||
|
|
||||||
|
.. _Checkup Command: https://git.etztech.xyz/24CarrotCraft/QoL/pulls/33
|
||||||
|
.. _Discord Syntax: https://git.etztech.xyz/24CarrotCraft/QoL/pulls/36
|
||||||
|
.. _Spec Confirm: https://git.etztech.xyz/24CarrotCraft/QoL/pulls/39
|
||||||
|
.. _Dynmap Link Command: https://git.etztech.xyz/24CarrotCraft/QoL/pulls/40
|
||||||
|
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
None
|
|
@ -0,0 +1,14 @@
|
||||||
|
.. include:: ../common.rst
|
||||||
|
|
||||||
|
.. _qol_v1.9:
|
||||||
|
|
||||||
|
QoL v1.9
|
||||||
|
========
|
||||||
|
|
||||||
|
Additions
|
||||||
|
---------
|
||||||
|
* `Marker Command`_ - allows a player to create a marker on the dynmap at their current location.
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
None
|
|
@ -41,4 +41,12 @@ Alias ``/names`` and ``/name``
|
||||||
|
|
||||||
``/deathmute <name>`` toggles death messages on or off for a player.
|
``/deathmute <name>`` toggles death messages on or off for a player.
|
||||||
|
|
||||||
|
``/checkup <start|next|stop>`` Start a checkup, teleporting to all online players.
|
||||||
|
|
||||||
|
``/dynmaplink [<map>] [<zoom>]`` Get a link to Dynmap with your current location. Optionally choose the map (flat, surface, etc.) and zoom level.
|
||||||
|
|
||||||
|
``/marker <set> <name>`` Creates a marker on the dynmap at the players current location.
|
||||||
|
|
||||||
|
``/marker <remove> <name>`` Removes a marker a user has created.
|
||||||
|
|
||||||
|
``/marker <list>`` Lists all the markers a player owns.
|
||||||
|
|
|
@ -60,3 +60,8 @@ World View Distance Override
|
||||||
Paper has removed this feature in ``1.14.x`` and so it has been disabled in QoL until it is re-implemented by Paper.
|
Paper has removed this feature in ``1.14.x`` and so it has been disabled in QoL until it is re-implemented by Paper.
|
||||||
|
|
||||||
Each world can have its own view distance. View distances of each world can be set in the config file. If no view distance is set, the view distance defaults to the one in server.properties.
|
Each world can have its own view distance. View distances of each world can be set in the config file. If no view distance is set, the view distance defaults to the one in server.properties.
|
||||||
|
|
||||||
|
QoL Dynmap Markers
|
||||||
|
------------------
|
||||||
|
QoL Markers are placed on their own layer which can be configured to be shown or hidden. The icon of the marker can be set in the `dynmap.marker_icon` config option.
|
||||||
|
The number of markers a player can have is set by the `qol.marker.limit.#` permission.
|
|
@ -24,7 +24,7 @@ Permissions
|
||||||
|
|
||||||
``qol.auditor`` - Ability to bypass auditing when running commands on auditable
|
``qol.auditor`` - Ability to bypass auditing when running commands on auditable
|
||||||
|
|
||||||
``qol.tpconfirm`` - Forces a player to confirm teleports when outside spectator mode
|
``qol.specconfirm`` - Forces a player to confirm a (configurable) command(s) when outside spectator mode
|
||||||
|
|
||||||
``qol.whitelist.bypass`` - Allows someone into the server when Whitelist mode is enabled
|
``qol.whitelist.bypass`` - Allows someone into the server when Whitelist mode is enabled
|
||||||
|
|
||||||
|
@ -38,8 +38,16 @@ Permissions
|
||||||
|
|
||||||
``qol.timeout.*`` - Wildcard permission for Timeout
|
``qol.timeout.*`` - Wildcard permission for Timeout
|
||||||
|
|
||||||
``qol.karattrophy`` - Ability to use the Karat Trophy Command
|
``qol.karattrophy`` - Ability to use the Karat Trophy command
|
||||||
|
|
||||||
|
``qol.dynmaplink`` - Ability to use the Dynmap Link command
|
||||||
|
|
||||||
``qol.deathmute`` - Ability to use the Death Mute command
|
``qol.deathmute`` - Ability to use the Death Mute command
|
||||||
|
|
||||||
``qol.griefalert`` - Receive GriefAlert alerts
|
``qol.griefalert`` - Receive GriefAlert alerts
|
||||||
|
|
||||||
|
``qol.checkup`` - Ability to use the Checkup command
|
||||||
|
|
||||||
|
``qol.discord`` - Use Discord (markdown) syntax for chat formatting
|
||||||
|
|
||||||
|
``qol.marker`` - Ability to use the Marker command
|
67
pom.xml
67
pom.xml
|
@ -3,7 +3,7 @@
|
||||||
<groupId>xyz.etztech</groupId>
|
<groupId>xyz.etztech</groupId>
|
||||||
<artifactId>QoL</artifactId>
|
<artifactId>QoL</artifactId>
|
||||||
<!-- Version is used in plugin.yml -->
|
<!-- Version is used in plugin.yml -->
|
||||||
<version>1.7</version>
|
<version>1.17</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<!-- Plugin Information -->
|
<!-- Plugin Information -->
|
||||||
|
@ -29,50 +29,63 @@
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.destroystokyo.paper</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>paper-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.14.3-R0.1-SNAPSHOT</version>
|
<version>1.16.3-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>xyz.etztech</groupId>
|
<groupId>xyz.etztech</groupId>
|
||||||
<artifactId>EtzCore</artifactId>
|
<artifactId>plugin-api</artifactId>
|
||||||
<version>1.0.5</version>
|
<version>1.0.7</version>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.ess3</groupId>
|
|
||||||
<artifactId>Essentials</artifactId>
|
|
||||||
<version>2.14-SNAPSHOT</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>us.dynmap</groupId>
|
<groupId>us.dynmap</groupId>
|
||||||
<artifactId>dynmap-api</artifactId>
|
<artifactId>dynmap-api</artifactId>
|
||||||
<version>1.9.4</version>
|
<version>3.5</version>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-lang</groupId>
|
<groupId>commons-lang</groupId>
|
||||||
<artifactId>commons-lang</artifactId>
|
<artifactId>commons-lang</artifactId>
|
||||||
<version>2.6</version>
|
<version>2.6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.discordsrv</groupId>
|
||||||
|
<artifactId>discordsrv</artifactId>
|
||||||
|
<version>1.27.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>me.lucko</groupId>
|
||||||
|
<artifactId>spark-api</artifactId>
|
||||||
|
<version>0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.nisovin.shopkeepers</groupId>
|
||||||
|
<artifactId>ShopkeepersAPI</artifactId>
|
||||||
|
<version>2.13.3</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<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>Scarsz-Nexus</id>
|
||||||
<url>http://repo.etztech.xyz</url>
|
<url>https://nexus.scarsz.me/content/groups/public/</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>birbmc-repo</id>
|
||||||
|
<url>https://mvn.jojodev.com</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>dynmap-repo</id>
|
<id>dynmap-repo</id>
|
||||||
<url>http://repo.mikeprimm.com/</url>
|
<url>https://repo.mikeprimm.com/</url>
|
||||||
</repository>
|
|
||||||
<repository>
|
|
||||||
<id>ess-repo</id>
|
|
||||||
<url>http://repo.ess3.net/content/groups/essentials</url>
|
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>mvn-repo</id>
|
<id>mvn-repo</id>
|
||||||
|
@ -80,12 +93,20 @@
|
||||||
</repository>
|
</repository>
|
||||||
<repository> <!-- This repo fixes issues with transitive dependencies -->
|
<repository> <!-- This repo fixes issues with transitive dependencies -->
|
||||||
<id>jcenter</id>
|
<id>jcenter</id>
|
||||||
<url>http://jcenter.bintray.com</url>
|
<url>https://jcenter.bintray.com</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>jitpack.io</id>
|
<id>jitpack.io</id>
|
||||||
<url>https://jitpack.io</url>
|
<url>https://jitpack.io</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>sonatype-snapshots</id>
|
||||||
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>shopkeepers-repo</id>
|
||||||
|
<url>https://repo.projectshard.dev/repository/releases/</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -7,6 +7,7 @@ import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -14,6 +15,7 @@ import java.io.InputStreamReader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class EtzTechUtil
|
public class EtzTechUtil
|
||||||
|
@ -36,8 +38,6 @@ public class EtzTechUtil
|
||||||
paramPlayer.sendMessage(ChatColor.translateAlternateColorCodes('&', paramString));
|
paramPlayer.sendMessage(ChatColor.translateAlternateColorCodes('&', paramString));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static UUID asUUID(String uuid) {
|
public static UUID asUUID(String uuid) {
|
||||||
try {
|
try {
|
||||||
if (uuid.contains("-") && uuid.length() == 36) {
|
if (uuid.contains("-") && uuid.length() == 36) {
|
||||||
|
@ -116,7 +116,18 @@ public class EtzTechUtil
|
||||||
return minutes*60*20;
|
return minutes*60*20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getPermValue(String perm, Set<PermissionAttachmentInfo> permissions) {
|
||||||
|
int limit = 0;
|
||||||
|
for (PermissionAttachmentInfo permission : permissions) {
|
||||||
|
if (permission.getPermission().startsWith(perm + ".") && permission.getValue()) {
|
||||||
|
try {
|
||||||
|
int p = Integer.parseInt(permission.getPermission().replaceFirst(perm + ".", ""));
|
||||||
|
limit = limit > p ? limit : p;
|
||||||
|
} catch (Exception ignored) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,27 +1,43 @@
|
||||||
package xyz.etztech.qol;
|
package xyz.etztech.qol;
|
||||||
|
|
||||||
import net.ess3.api.IEssentials;
|
import com.nisovin.shopkeepers.api.ShopkeepersPlugin;
|
||||||
|
import github.scarsz.discordsrv.DiscordSRV;
|
||||||
|
import net.md_5.bungee.api.chat.BaseComponent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.dynmap.DynmapAPI;
|
import org.dynmap.DynmapAPI;
|
||||||
|
import org.dynmap.markers.Marker;
|
||||||
|
import org.dynmap.markers.MarkerAPI;
|
||||||
|
import org.dynmap.markers.MarkerIcon;
|
||||||
|
import org.dynmap.markers.MarkerSet;
|
||||||
import xyz.etztech.qol.commands.*;
|
import xyz.etztech.qol.commands.*;
|
||||||
import xyz.etztech.qol.listeners.*;
|
import xyz.etztech.qol.listeners.*;
|
||||||
import xyz.etztech.qol.other.GriefAlert;
|
|
||||||
import xyz.etztech.qol.other.LinkCommand;
|
import xyz.etztech.qol.other.LinkCommand;
|
||||||
|
import xyz.etztech.qol.other.Reminder;
|
||||||
import xyz.etztech.qol.other.TPSRunnable;
|
import xyz.etztech.qol.other.TPSRunnable;
|
||||||
|
import me.lucko.spark.api.Spark;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class QoL extends JavaPlugin {
|
public class QoL extends JavaPlugin {
|
||||||
|
|
||||||
|
static private final String qolMarkerSetName = "qolMarkerSet";
|
||||||
|
private String qolMarkerIcon = null;
|
||||||
|
|
||||||
private static QoL instance;
|
private static QoL instance;
|
||||||
private IEssentials essentials = null;
|
private Spark spark = null;
|
||||||
private DynmapAPI dynmap = null;
|
private DynmapAPI dynmap = null;
|
||||||
|
private MarkerAPI markerAPI = null;
|
||||||
|
private MarkerSet playerMarkerSet = null;
|
||||||
|
private boolean qolMarkerLayerShow = false;
|
||||||
|
private String qolMarkerSetLabel = null;
|
||||||
|
|
||||||
public static FileConfiguration config;
|
public static FileConfiguration config;
|
||||||
private Logger log = Logger.getLogger( "Minecraft" );
|
private Logger log = Logger.getLogger( "Minecraft" );
|
||||||
|
@ -33,8 +49,7 @@ public class QoL extends JavaPlugin {
|
||||||
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 Reminder reminder = null;
|
||||||
private GriefAlert griefAlert;
|
|
||||||
|
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
instance = this;
|
instance = this;
|
||||||
|
@ -42,79 +57,91 @@ public class QoL extends JavaPlugin {
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
saveResource("qol.png", true);
|
saveResource("qol.png", true);
|
||||||
|
|
||||||
//Essentials hook
|
//Spark hook
|
||||||
if (Bukkit.getPluginManager().isPluginEnabled("Essentials")) {
|
RegisteredServiceProvider<Spark> sparkProvider = Bukkit.getServicesManager().getRegistration(Spark.class);
|
||||||
log("Hooked into Essentials for TPS alert.");
|
if (sparkProvider != null) {
|
||||||
essentials = (IEssentials) Bukkit.getPluginManager().getPlugin("Essentials");
|
log("Hooked into Spark for TPS alert.");
|
||||||
|
spark = sparkProvider.getProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Dynmap hook
|
//Dynmap hook
|
||||||
if (Bukkit.getPluginManager().isPluginEnabled("dynmap")) {
|
if (Bukkit.getPluginManager().isPluginEnabled("dynmap")) {
|
||||||
log("Hooked into Dynmap.");
|
log("Hooked into Dynmap.");
|
||||||
dynmap = (DynmapAPI) Bukkit.getPluginManager().getPlugin("dynmap");
|
dynmap = (DynmapAPI) Bukkit.getPluginManager().getPlugin("dynmap");
|
||||||
|
|
||||||
|
// Marker setup
|
||||||
|
if (dynmap != null) {
|
||||||
|
markerAPI = dynmap.getMarkerAPI();
|
||||||
|
|
||||||
|
playerMarkerSet = markerAPI.getMarkerSet(qolMarkerSetName);
|
||||||
|
|
||||||
|
if (playerMarkerSet == null) {
|
||||||
|
playerMarkerSet = markerAPI.createMarkerSet(qolMarkerSetName, qolMarkerSetLabel, null, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (playerMarkerSet == null) {
|
||||||
|
log("Unable to create marker set");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
playerMarkerSet.setHideByDefault(!qolMarkerLayerShow);
|
||||||
|
playerMarkerSet.setMarkerSetLabel(qolMarkerSetLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DiscordSRV Hook
|
||||||
|
if (Bukkit.getPluginManager().isPluginEnabled("DiscordSRV")) {
|
||||||
|
new DiscordSRVListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shopkeepers Hook
|
||||||
|
if (Bukkit.getPluginManager().isPluginEnabled("Shopkeepers")) {
|
||||||
|
new HeadShopListener(this);
|
||||||
|
log("Hooked in Shopkeepers for the head shop");
|
||||||
}
|
}
|
||||||
|
|
||||||
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 EntityChangeBlockListener(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);
|
|
||||||
|
|
||||||
// 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);
|
new WikiCommand(this);
|
||||||
this.getCommand("whitelist").setExecutor(whitelistCommand);
|
new MoonCommand(this);
|
||||||
TimeoutCommand timeoutCommand = new TimeoutCommand(this);
|
|
||||||
this.getCommand("timeout").setExecutor(timeoutCommand);
|
if (DiscordSRV.api.isAnyHooked()) {
|
||||||
ColorsCommand colorsCommand = new ColorsCommand(this);
|
new DiscordIgnoreCommand(this);
|
||||||
this.getCommand("colors").setExecutor(colorsCommand);
|
}
|
||||||
WorldInfoCommand worldInfoCommand = new WorldInfoCommand(this);
|
|
||||||
this.getCommand("worldinfo").setExecutor(worldInfoCommand);
|
if (dynmap != null) {
|
||||||
DeathMuteCommand deathMuteCommand = new DeathMuteCommand(this);
|
new MarkerCommand(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);
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -130,33 +157,21 @@ public class QoL extends JavaPlugin {
|
||||||
}, 0, EtzTechUtil.minutesToTicks(schedule));
|
}, 0, EtzTechUtil.minutesToTicks(schedule));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reminders
|
if (reminder != null && reminder.getFrequency() != 0) {
|
||||||
int frequency = config.getInt("reminders.frequency");
|
|
||||||
if (frequency > 0) {
|
|
||||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(QoL.getInstance(), new Runnable() {
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(QoL.getInstance(), new Runnable() {
|
||||||
int idx = 0;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
List<String> reminders = config.getStringList("reminders.messages");
|
BaseComponent [] msg = reminder.nextReminder();
|
||||||
ChatColor color = ChatColor.getByChar(config.getString("reminders.color").replace("&", ""));
|
|
||||||
if (idx >= reminders.size()) {
|
|
||||||
idx = 0;
|
|
||||||
}
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
EtzTechUtil.sms(player, color + reminders.get(idx));
|
player.spigot().sendMessage(msg);
|
||||||
}
|
}
|
||||||
idx++;
|
Bukkit.getConsoleSender().spigot().sendMessage(msg);
|
||||||
}
|
}
|
||||||
}, 0, EtzTechUtil.minutesToTicks(frequency));
|
}, 0, EtzTechUtil.minutesToTicks(reminder.getFrequency()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TPS Check
|
// TPS Check
|
||||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(QoL.getInstance(), new TPSRunnable(this), 0, EtzTechUtil.minutesToTicks(1));
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(QoL.getInstance(), new TPSRunnable(this), 0, EtzTechUtil.minutesToTicks(1));
|
||||||
|
|
||||||
// Grief Alert
|
|
||||||
griefAlert = new GriefAlert(this);
|
|
||||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(QoL.getInstance(), griefAlert, 0, EtzTechUtil.minutesToTicks(10));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,16 +196,11 @@ public class QoL extends JavaPlugin {
|
||||||
links.add(LinkCommand.fromString(raw));
|
links.add(LinkCommand.fromString(raw));
|
||||||
}
|
}
|
||||||
|
|
||||||
viewDistances = new HashMap<>();
|
qolMarkerIcon = config.getString("dynmap.marker_icon", "blueflag");
|
||||||
|
qolMarkerLayerShow = config.getBoolean("dynmap.marker_set_show", false);
|
||||||
|
qolMarkerSetLabel = config.getString("dynmap.marker_set_label", "QoL Markers");
|
||||||
|
|
||||||
ConfigurationSection view_distances = config.getConfigurationSection("view-distances");
|
reminder = Reminder.fromConfig(config.getConfigurationSection("reminders"));
|
||||||
|
|
||||||
for (String worldName : view_distances.getKeys(false)) {
|
|
||||||
|
|
||||||
int viewDistance = view_distances.getInt(worldName);
|
|
||||||
|
|
||||||
viewDistances.put(worldName, viewDistance);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -287,24 +297,61 @@ public class QoL extends JavaPlugin {
|
||||||
return links;
|
return links;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEssentials getEssentials() { return essentials; }
|
|
||||||
|
|
||||||
public DynmapAPI getDynmap() { return dynmap; }
|
public DynmapAPI getDynmap() { return dynmap; }
|
||||||
|
|
||||||
public GriefAlert getGriefAlert() {
|
|
||||||
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) {
|
public MarkerSet getPlayerMarkerSet() {
|
||||||
//player.setViewDistance(viewDistances.getOrDefault(player.getWorld().getName().toLowerCase(), getServer().getViewDistance()));
|
return playerMarkerSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Marker> getPlayerMarkers(Player player) {
|
||||||
|
ArrayList<Marker> markers = new ArrayList<>();
|
||||||
|
String player_uuid = EtzTechUtil.formatUUID(player.getUniqueId().toString(), true);
|
||||||
|
for (Marker marker: playerMarkerSet.getMarkers()) {
|
||||||
|
if (marker.getMarkerID().contains(player_uuid)) {
|
||||||
|
markers.add(marker);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return markers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMarkerName(Player player, String name) {
|
||||||
|
String uuid = EtzTechUtil.formatUUID(player.getUniqueId().toString(), true);
|
||||||
|
return uuid + " " + name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createMarkerAtPlayer(Player player, String name) {
|
||||||
|
Location location = player.getLocation();
|
||||||
|
MarkerIcon icon = markerAPI.getMarkerIcon(qolMarkerIcon);
|
||||||
|
|
||||||
|
Marker playerMarker = getPlayerMarker(player, name);
|
||||||
|
|
||||||
|
if (playerMarker != null) {
|
||||||
|
playerMarker.deleteMarker();
|
||||||
|
}
|
||||||
|
|
||||||
|
playerMarkerSet.createMarker(getMarkerName(player, name), name, true, player.getWorld().getName(), location.getX(), location.getY(), location.getZ(), icon, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Marker getPlayerMarker(Player player, String name) {
|
||||||
|
Marker marker = playerMarkerSet.findMarker(getMarkerName(player, name));
|
||||||
|
|
||||||
|
// Find marker using old naming system
|
||||||
|
if (marker == null) {
|
||||||
|
String uuid = EtzTechUtil.formatUUID(player.getUniqueId().toString(), false);
|
||||||
|
return playerMarkerSet.findMarker(uuid);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return marker;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Spark getSpark() {
|
||||||
|
return spark;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
||||||
|
@ -107,7 +107,7 @@ public class CheckupCommand implements CommandExecutor {
|
||||||
while (checkup.hasNext()) {
|
while (checkup.hasNext()) {
|
||||||
// Loop until next player is online
|
// Loop until next player is online
|
||||||
next = checkup.next();
|
next = checkup.next();
|
||||||
if (next.isOnline()) {
|
if (next.isOnline() && player.getUniqueId() != next.getUniqueId()) {
|
||||||
player.teleport(next.getLocation());
|
player.teleport(next.getLocation());
|
||||||
EtzTechUtil.sms(player, ChatColor.GREEN + "You are now checking on " + ChatColor.YELLOW + next.getName());
|
EtzTechUtil.sms(player, ChatColor.GREEN + "You are now checking on " + ChatColor.YELLOW + next.getName());
|
||||||
checkups.put(player.getUniqueId(), checkup);
|
checkups.put(player.getUniqueId(), checkup);
|
||||||
|
|
|
@ -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
|
||||||
|
@ -29,7 +30,7 @@ public class ColorsCommand implements CommandExecutor {
|
||||||
ChatColor.DARK_GRAY + "\n&8 - Dark Gray" +
|
ChatColor.DARK_GRAY + "\n&8 - Dark Gray" +
|
||||||
ChatColor.BLUE + "\n&9 - Blue" +
|
ChatColor.BLUE + "\n&9 - Blue" +
|
||||||
ChatColor.GREEN + "\n&a - Green" +
|
ChatColor.GREEN + "\n&a - Green" +
|
||||||
ChatColor.AQUA + "\n&b - Aqu" +
|
ChatColor.AQUA + "\n&b - Aqua" +
|
||||||
ChatColor.RED + "\n&c - Red" +
|
ChatColor.RED + "\n&c - Red" +
|
||||||
ChatColor.LIGHT_PURPLE + "\n&d - Light Purple" +
|
ChatColor.LIGHT_PURPLE + "\n&d - Light Purple" +
|
||||||
ChatColor.YELLOW + "\n&e - Yellow" +
|
ChatColor.YELLOW + "\n&e - Yellow" +
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
package xyz.etztech.qol.commands;
|
||||||
|
|
||||||
|
import github.scarsz.discordsrv.DiscordSRV;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
|
import xyz.etztech.qol.EtzTechUtil;
|
||||||
|
import xyz.etztech.qol.Lang;
|
||||||
|
import xyz.etztech.qol.QoL;
|
||||||
|
|
||||||
|
public class DiscordIgnoreCommand implements CommandExecutor {
|
||||||
|
public static final String DISCORD_IGNORE_METADATA = "qol.discord_ignore";
|
||||||
|
QoL plugin;
|
||||||
|
|
||||||
|
public DiscordIgnoreCommand(QoL plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
plugin.getCommand("discordignore").setExecutor(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
|
||||||
|
if (!( commandSender instanceof Player)) {
|
||||||
|
EtzTechUtil.sms(commandSender, Lang.NO_CONSOLE.getDef());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!commandSender.hasPermission("qol.discordignore")) {
|
||||||
|
EtzTechUtil.sms(commandSender, Lang.NO_PERMISSION.getDef());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!DiscordSRV.api.isAnyHooked()) {
|
||||||
|
EtzTechUtil.sms(commandSender, "Command not enabled!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = (Player) commandSender;
|
||||||
|
|
||||||
|
boolean ignoreState = player.hasMetadata(DISCORD_IGNORE_METADATA);
|
||||||
|
String msg;
|
||||||
|
if (ignoreState) {
|
||||||
|
player.removeMetadata(DISCORD_IGNORE_METADATA, plugin);
|
||||||
|
msg = "Discord messages will now appear.";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
player.setMetadata(DISCORD_IGNORE_METADATA, new FixedMetadataValue(plugin, DISCORD_IGNORE_METADATA));
|
||||||
|
msg = "Ignoring Discord messages.";
|
||||||
|
}
|
||||||
|
|
||||||
|
EtzTechUtil.sms(commandSender, org.bukkit.ChatColor.GREEN + msg);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package xyz.etztech.qol.commands;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.ChatColor;
|
||||||
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import xyz.etztech.qol.EtzTechUtil;
|
||||||
|
import xyz.etztech.qol.Lang;
|
||||||
|
import xyz.etztech.qol.QoL;
|
||||||
|
|
||||||
|
public class DynmapLinkCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
QoL plugin;
|
||||||
|
|
||||||
|
public DynmapLinkCommand(QoL plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
plugin.getCommand("dynmaplink").setExecutor(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
|
||||||
|
if (!( commandSender instanceof Player)) {
|
||||||
|
EtzTechUtil.sms(commandSender, Lang.NO_CONSOLE.getDef());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = (Player) commandSender;
|
||||||
|
|
||||||
|
String base = plugin.getConfig().getString("dynmap.url", "");
|
||||||
|
String defaultMap = plugin.getConfig().getString("dynmap.defaults.map", "surface");
|
||||||
|
String defaultZoom = String.valueOf(plugin.getConfig().getInt("dynmap.defaults.zoom", 5));
|
||||||
|
|
||||||
|
TextComponent message;
|
||||||
|
if (base.trim().length() > 0) {
|
||||||
|
String world = player.getWorld().getName();
|
||||||
|
Location location = player.getLocation();
|
||||||
|
String x = String.valueOf(location.getX());
|
||||||
|
String y = String.valueOf(location.getY());
|
||||||
|
String z = String.valueOf(location.getZ());
|
||||||
|
String map = args.length > 0 ? args[0] : defaultMap;
|
||||||
|
String zoom = args.length > 1 ? args[1] : defaultZoom;
|
||||||
|
String url = String.format("%s?worldname=%s&mapname=%s&zoom=%s&x=%s&y=%s&z=%s", base, world, map, zoom, x, y, z);
|
||||||
|
message = new TextComponent("Click here to see your location on Dynmap.");
|
||||||
|
message.setColor(ChatColor.YELLOW);
|
||||||
|
message.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url));
|
||||||
|
} else {
|
||||||
|
message = new TextComponent("This command is currently disabled or the server has no Dynmap!");
|
||||||
|
message.setColor(ChatColor.RED);
|
||||||
|
}
|
||||||
|
player.spigot().sendMessage(message);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -0,0 +1,127 @@
|
||||||
|
|
||||||
|
package xyz.etztech.qol.commands;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.TabExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.dynmap.markers.Marker;
|
||||||
|
import org.dynmap.markers.MarkerSet;
|
||||||
|
import xyz.etztech.qol.EtzTechUtil;
|
||||||
|
import xyz.etztech.qol.Lang;
|
||||||
|
import xyz.etztech.qol.QoL;
|
||||||
|
import static org.apache.commons.lang.StringEscapeUtils.escapeHtml;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class MarkerCommand implements CommandExecutor, TabExecutor{
|
||||||
|
QoL plugin;
|
||||||
|
List<String> subCommandList = Arrays.asList("set", "remove", "list");
|
||||||
|
|
||||||
|
public MarkerCommand(QoL paramQoL) {
|
||||||
|
this.plugin = paramQoL;
|
||||||
|
plugin.getCommand("marker").setExecutor(this);
|
||||||
|
plugin.getCommand("marker").setTabCompleter(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
|
||||||
|
if (!( commandSender instanceof Player)) {
|
||||||
|
EtzTechUtil.sms(commandSender, Lang.NO_CONSOLE.getDef());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = (Player) commandSender;
|
||||||
|
|
||||||
|
if (!player.hasPermission("qol.marker")) {
|
||||||
|
EtzTechUtil.sms(player, Lang.NO_PERMISSION.getDef());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.length < 1) {
|
||||||
|
EtzTechUtil.sms(player, ChatColor.RED + "/marker set");
|
||||||
|
EtzTechUtil.sms(player, ChatColor.RED + "/marker remove");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
String action = args[0].toLowerCase();
|
||||||
|
String name;
|
||||||
|
if (args.length > 1) {
|
||||||
|
String[] arr = Arrays.copyOfRange(args, 1, args.length);
|
||||||
|
|
||||||
|
name = String.join(" ", arr);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
name = (player).getDisplayName();
|
||||||
|
}
|
||||||
|
|
||||||
|
name = escapeHtml(name);
|
||||||
|
|
||||||
|
if (name.length() > 50) {
|
||||||
|
EtzTechUtil.sms(player, ChatColor.RED + "Marker name too long, try a shorter name");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (action.equals("set")) {
|
||||||
|
int marker_count = plugin.getPlayerMarkers(player).size();
|
||||||
|
|
||||||
|
if (marker_count >= EtzTechUtil.getPermValue("qol.marker.limit", player.getEffectivePermissions())) {
|
||||||
|
EtzTechUtil.sms(player, ChatColor.RED + "You can't add more markers, delete an old one first.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
plugin.createMarkerAtPlayer(player, name);
|
||||||
|
EtzTechUtil.sms(player, ChatColor.GREEN + "Marker \"" + name + "\" created");
|
||||||
|
}
|
||||||
|
else if (action.equals("remove")) {
|
||||||
|
Marker marker = plugin.getPlayerMarker(player, name);
|
||||||
|
if (marker != null) {
|
||||||
|
marker.deleteMarker();
|
||||||
|
EtzTechUtil.sms(player, ChatColor.GREEN + "Marker \"" + name +"\" removed.");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
EtzTechUtil.sms(player, ChatColor.RED + "You don't have a marker by that name");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (action.equals("list")) {
|
||||||
|
MarkerSet markerSet = plugin.getPlayerMarkerSet();
|
||||||
|
StringBuilder msg = new StringBuilder();
|
||||||
|
int marker_count = 0;
|
||||||
|
|
||||||
|
msg.append(ChatColor.GREEN);
|
||||||
|
msg.append("You have the following markers:\n");
|
||||||
|
msg.append(ChatColor.YELLOW);
|
||||||
|
for (Marker marker: plugin.getPlayerMarkers(player)) {
|
||||||
|
msg.append(marker.getLabel());
|
||||||
|
msg.append('\n');
|
||||||
|
marker_count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (marker_count == 0) {
|
||||||
|
EtzTechUtil.sms(player, ChatColor.RED + "You don't have any markers");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
EtzTechUtil.sms(player, msg.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> onTabComplete(CommandSender commandSender, Command command, String s, String[] strings) {
|
||||||
|
for (String arg: strings) {
|
||||||
|
if (subCommandList.contains(arg)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return subCommandList;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package xyz.etztech.qol.commands;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import xyz.etztech.qol.QoL;
|
||||||
|
import xyz.etztech.qol.EtzTechUtil;
|
||||||
|
import xyz.etztech.qol.Lang;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.lang.*;
|
||||||
|
|
||||||
|
public class MoonCommand implements CommandExecutor {
|
||||||
|
QoL plugin;
|
||||||
|
|
||||||
|
private final Map<Integer, String> moonPhases = Map.of(
|
||||||
|
0, "Full moon",
|
||||||
|
1, "Waning gibbous",
|
||||||
|
2, "Third quarter",
|
||||||
|
3, "Waning crescent",
|
||||||
|
4, "New moon",
|
||||||
|
5, "Waxing crescent",
|
||||||
|
6, "First quarter",
|
||||||
|
7, "Waxing gibbous"
|
||||||
|
);
|
||||||
|
|
||||||
|
public MoonCommand(QoL paramQoL) {
|
||||||
|
this.plugin = paramQoL;
|
||||||
|
plugin.getCommand("moon").setExecutor(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
|
||||||
|
if (!commandSender.hasPermission("qol.moon")) {
|
||||||
|
EtzTechUtil.sms(commandSender, Lang.NO_PERMISSION.getDef());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
String playername = commandSender.getName();
|
||||||
|
long time = commandSender.getServer().getPlayer(playername).getWorld().getFullTime();
|
||||||
|
double day = Math.floor(time / 24000);
|
||||||
|
int moonPhase = (int)(day % 8);
|
||||||
|
|
||||||
|
StringBuilder message = new StringBuilder(ChatColor.GOLD + "===== Moon Phase Utility =====");
|
||||||
|
message.append("\n" + ChatColor.GREEN + "Current moon phase: " + moonPhases.get(moonPhase) + ".");
|
||||||
|
message.append("\n" + ChatColor.GREEN + "Full moon is " + (moonPhase == 0 ? "tonight." : "in " + (8 - moonPhase) + ((moonPhase == 7) ? " day." : " days.")));
|
||||||
|
EtzTechUtil.sms(commandSender, message.toString());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -9,16 +9,18 @@ import org.bukkit.entity.Player;
|
||||||
import xyz.etztech.qol.EtzTechUtil;
|
import xyz.etztech.qol.EtzTechUtil;
|
||||||
import xyz.etztech.qol.Lang;
|
import xyz.etztech.qol.Lang;
|
||||||
import xyz.etztech.qol.QoL;
|
import xyz.etztech.qol.QoL;
|
||||||
import xyz.etztech.qol.other.ShadowMuteTime;
|
import xyz.etztech.core.command.TickDuration;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
|
||||||
public class ShadowMuteCommand implements CommandExecutor {
|
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
|
||||||
|
@ -43,16 +45,16 @@ public class ShadowMuteCommand implements CommandExecutor {
|
||||||
|
|
||||||
final Player player = argPlayer;
|
final Player player = argPlayer;
|
||||||
|
|
||||||
ShadowMuteTime smt;
|
TickDuration duration;
|
||||||
try {
|
try {
|
||||||
smt = ShadowMuteTime.parse(args[1]);
|
duration = TickDuration.parse(args[1]);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
smt = new ShadowMuteTime();
|
duration = new TickDuration(Duration.ofMinutes(5));
|
||||||
commandSender.sendMessage(ChatColor.RED + ex.getMessage());
|
commandSender.sendMessage(ChatColor.RED + ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
EtzTechUtil.sms(commandSender, ChatColor.GREEN + "Shadow Muting " + ChatColor.YELLOW +
|
EtzTechUtil.sms(commandSender, ChatColor.GREEN + "Shadow Muting " + ChatColor.YELLOW +
|
||||||
player.getName() + ChatColor.GREEN + " for " + ChatColor.YELLOW + smt.toString());
|
player.getName() + ChatColor.GREEN + " for " + ChatColor.YELLOW + duration.getDuration().toMinutes() + "minutes.");
|
||||||
QoL.addSM(player);
|
QoL.addSM(player);
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
|
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
|
||||||
|
@ -61,7 +63,7 @@ public class ShadowMuteCommand implements CommandExecutor {
|
||||||
Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "Removing Shadow Mute for " + ChatColor.YELLOW + player.getName());
|
Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "Removing Shadow Mute for " + ChatColor.YELLOW + player.getName());
|
||||||
QoL.removeSM(player);
|
QoL.removeSM(player);
|
||||||
}
|
}
|
||||||
}, smt.toTicks());
|
}, duration.toTicks());
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
package xyz.etztech.qol.commands;
|
||||||
|
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.TabExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import xyz.etztech.qol.QoL;
|
||||||
|
import xyz.etztech.qol.EtzTechUtil;
|
||||||
|
import xyz.etztech.qol.Lang;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class WikiCommand implements TabExecutor {
|
||||||
|
QoL plugin;
|
||||||
|
|
||||||
|
public WikiCommand(QoL paramQoL) {
|
||||||
|
this.plugin = paramQoL;
|
||||||
|
plugin.getCommand("wiki").setExecutor(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender commandSender, Command command, String label, String[] args) {
|
||||||
|
if (!commandSender.hasPermission("qol.wiki")) {
|
||||||
|
EtzTechUtil.sms(commandSender, Lang.NO_PERMISSION.getDef());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (args.length < 1) {
|
||||||
|
EtzTechUtil.sms(commandSender, ChatColor.RED + "Please give a search argument.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
String query = String.join(" ", args);
|
||||||
|
List<List<String>> result = getWikiResults(query, 1);
|
||||||
|
|
||||||
|
if (result.isEmpty())
|
||||||
|
{
|
||||||
|
EtzTechUtil.sms(commandSender, ChatColor.RED + String.format("Nothing was found on the wiki using: %s", query));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
String message = ChatColor.GREEN + result.get(0).get(0) + ": " + ChatColor.WHITE + result.get(0).get(1);
|
||||||
|
EtzTechUtil.sms(commandSender, message);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> onTabComplete(CommandSender commandSender, Command command, String label, String[] args) {
|
||||||
|
String query = String.join(" ", args);
|
||||||
|
|
||||||
|
if (query.isEmpty()) return null;
|
||||||
|
|
||||||
|
List<List<String>> results = getWikiResults(query, 10);
|
||||||
|
|
||||||
|
if (results.isEmpty()) return null;
|
||||||
|
|
||||||
|
List<String> completions = new ArrayList<>();
|
||||||
|
results.forEach((result) -> completions.add(result.get(0)));
|
||||||
|
return completions;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<List<String>> getWikiResults(String query, Integer numOfResults) {
|
||||||
|
try {
|
||||||
|
InputStream response = new URL(String.format(plugin.getConfig().getString("wiki-base-url", "https://minecraft.wiki:") + "/api.php?action=opensearch&format=json&formatversion=2&search=%s&namespace=0&limit=%d", query, numOfResults)).openStream();
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(response));
|
||||||
|
JsonArray jsonArray = new JsonParser().parse(reader.readLine()).getAsJsonArray();
|
||||||
|
|
||||||
|
JsonArray names = jsonArray.get(1).getAsJsonArray();
|
||||||
|
JsonArray links = jsonArray.get(3).getAsJsonArray();
|
||||||
|
|
||||||
|
// Check if we got any result
|
||||||
|
if (names.size() < 1)
|
||||||
|
return Collections.emptyList();
|
||||||
|
|
||||||
|
List<List<String>> results = new ArrayList<>();
|
||||||
|
for (int i = 0; i < names.size(); i++)
|
||||||
|
{
|
||||||
|
List<String> e = new ArrayList<>();
|
||||||
|
e.add(names.get(i).getAsString());
|
||||||
|
e.add(links.get(i).getAsString());
|
||||||
|
results.add(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
} catch(Exception e) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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
|
||||||
|
|
|
@ -1,27 +1,33 @@
|
||||||
package xyz.etztech.qol.listeners;
|
package xyz.etztech.qol.listeners;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
import org.bukkit.event.server.ServerListPingEvent;
|
|
||||||
import org.bukkit.util.CachedServerIcon;
|
|
||||||
import xyz.etztech.qol.QoL;
|
import xyz.etztech.qol.QoL;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import java.util.Arrays;
|
||||||
import java.awt.*;
|
import java.util.List;
|
||||||
import java.awt.image.BufferedImage;
|
import java.util.regex.Matcher;
|
||||||
import java.io.File;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class AsyncPlayerChatListener implements Listener {
|
public class AsyncPlayerChatListener implements Listener {
|
||||||
|
|
||||||
|
private final List<Pattern> discordSyntax = Arrays.asList(
|
||||||
|
Pattern.compile("__([^_]+)__"), // 0: __underline__
|
||||||
|
Pattern.compile("_([^_]+)_"), // 1: _italic_
|
||||||
|
Pattern.compile("\\*\\*([^*]+)\\*\\*"), // 2: **bold**
|
||||||
|
Pattern.compile("\\*([^*]+)\\*"), // 3: *italic*
|
||||||
|
Pattern.compile("~~([^~]+)~~") // 4: ~~strikethrough~~
|
||||||
|
);
|
||||||
|
|
||||||
private QoL plugin;
|
private QoL plugin;
|
||||||
|
|
||||||
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)
|
||||||
|
@ -36,6 +42,50 @@ public class AsyncPlayerChatListener implements Listener {
|
||||||
if (QoL.getTimeout() && !player.hasPermission("qol.timeout.bypass")) {
|
if (QoL.getTimeout() && !player.hasPermission("qol.timeout.bypass")) {
|
||||||
event.getRecipients().clear();
|
event.getRecipients().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Discord syntax for font emphasis
|
||||||
|
if (player.hasPermission("qol.discord")) {
|
||||||
|
String chat = event.getMessage();
|
||||||
|
boolean escape = false;
|
||||||
|
|
||||||
|
// Escape
|
||||||
|
if (chat.startsWith("\\")) {
|
||||||
|
escape = true;
|
||||||
|
event.setMessage(chat.substring(1));
|
||||||
|
|
||||||
|
// Escape the escape, this monster wants to start their message with a backslash
|
||||||
|
if (chat.startsWith("\\\\")) {
|
||||||
|
escape = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!escape) {
|
||||||
|
Pattern syntax;
|
||||||
|
Matcher matcher;
|
||||||
|
for (int i = 0; i < discordSyntax.size(); i++) {
|
||||||
|
syntax = discordSyntax.get(i);
|
||||||
|
matcher = syntax.matcher(chat);
|
||||||
|
switch (i) {
|
||||||
|
case 0:
|
||||||
|
chat = matcher.replaceAll("&n$1&r");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
case 3:
|
||||||
|
chat = matcher.replaceAll("&o$1&r");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
chat = matcher.replaceAll("&l$1&r");
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
chat = matcher.replaceAll("&m$1&r");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
event.setMessage(ChatColor.translateAlternateColorCodes('&', chat));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
@ -19,9 +20,5 @@ public class BlockIgniteListener implements Listener {
|
||||||
if (plugin.getConfig().getBoolean("disable-fire." + cause.name().toLowerCase())) {
|
if (plugin.getConfig().getBoolean("disable-fire." + cause.name().toLowerCase())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getPlayer() != null && (cause == BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL || cause == BlockIgniteEvent.IgniteCause.FIREBALL)) {
|
|
||||||
plugin.getGriefAlert().addAlert(event.getPlayer().getName() + " started a fire.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
package xyz.etztech.qol.listeners;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
|
||||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
|
||||||
import xyz.etztech.qol.QoL;
|
|
||||||
|
|
||||||
public class BlockPlaceListener implements Listener {
|
|
||||||
|
|
||||||
QoL plugin;
|
|
||||||
|
|
||||||
public BlockPlaceListener(QoL plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onBlockPlace(BlockPlaceEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
if( event.getBlockPlaced().getType() == Material.TNT) {
|
|
||||||
plugin.getGriefAlert().addAlert(player.getName() + " placed TnT.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,34 +1,31 @@
|
||||||
package xyz.etztech.qol.listeners;
|
package xyz.etztech.qol.listeners;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
import org.bukkit.event.server.ServerCommandEvent;
|
import org.bukkit.event.server.ServerCommandEvent;
|
||||||
import xyz.etztech.core.CoreUtils;
|
import org.dynmap.DynmapAPI;
|
||||||
import xyz.etztech.core.web.CoreWeb;
|
import xyz.etztech.core.web.Http;
|
||||||
import xyz.etztech.qol.QoL;
|
import xyz.etztech.qol.QoL;
|
||||||
import xyz.etztech.qol.other.LinkCommand;
|
import xyz.etztech.qol.other.LinkCommand;
|
||||||
import org.dynmap.DynmapAPI;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class CommandPreprocessListener implements Listener {
|
public class CommandPreprocessListener implements Listener {
|
||||||
|
|
||||||
QoL plugin;
|
QoL plugin;
|
||||||
private Map<UUID, String> confirmTpMap = new HashMap<>();
|
private Map<UUID, String> confirmMap = new HashMap<>();
|
||||||
private Map<UUID, Boolean> dynmapVisibleStatusMap = new HashMap<>();
|
private Map<UUID, Boolean> dynmapVisibleStatusMap = new HashMap<>();
|
||||||
|
|
||||||
public CommandPreprocessListener(QoL plugin) {
|
public CommandPreprocessListener(QoL plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -73,27 +70,39 @@ public class CommandPreprocessListener implements Listener {
|
||||||
visibleStatus = true;
|
visibleStatus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.spigot().sendMessage(new TextComponent(ChatColor.GREEN + message));
|
TextComponent textComponent = new TextComponent(message);
|
||||||
|
textComponent.setColor(ChatColor.GREEN);
|
||||||
|
sender.spigot().sendMessage(textComponent);
|
||||||
dynmap.setPlayerVisiblity(sender.getName(), visibleStatus);
|
dynmap.setPlayerVisiblity(sender.getName(), visibleStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spec TP confirmation
|
// Spec confirmation
|
||||||
if (sender.hasPermission("qol.tpconfirm")) {
|
List<String> specConfirm = plugin.getConfig().getStringList("spec-confirm");
|
||||||
//check if the command is a tp command
|
if (sender.hasPermission("qol.specconfirm")) {
|
||||||
if (noSlash(base).equals("tp") || noSlash(base).toLowerCase().startsWith("tele") || noSlash(command).toLowerCase().startsWith("lagg tpchunk")) {
|
boolean confirm = false;
|
||||||
//If the user is in the confirm tp map, remove them and let the command run
|
for (String confirmable : specConfirm) {
|
||||||
if (command.equals(confirmTpMap.get(sender.getUniqueId()))) {
|
// If the player command either starts with a confirmable command and space (meaning confirmation is needed regardless of arguments)
|
||||||
confirmTpMap.remove(sender.getUniqueId());
|
// Or the player command is a full match to the confirmable command
|
||||||
|
if (noSlash(command).toLowerCase().startsWith(confirmable.toLowerCase() + " ") || noSlash(command).toLowerCase().equals(confirmable.toLowerCase())) {
|
||||||
|
confirm = true;
|
||||||
}
|
}
|
||||||
//If the user is running the tp command for the first time outside of spec
|
}
|
||||||
|
//check if the command is a spec confirm command
|
||||||
|
if (confirm) {
|
||||||
|
//If the user is in the confirm map, remove them and let the command run
|
||||||
|
if (command.equals(confirmMap.get(sender.getUniqueId()))) {
|
||||||
|
confirmMap.remove(sender.getUniqueId());
|
||||||
|
}
|
||||||
|
//If the user is running the command for the first time outside of spec
|
||||||
else if (sender.getGameMode() != GameMode.SPECTATOR) {
|
else if (sender.getGameMode() != GameMode.SPECTATOR) {
|
||||||
//Cancel the command
|
//Cancel the command
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
//Add the user to the tp confirm map
|
//Add the user to the spec confirm map
|
||||||
confirmTpMap.put(sender.getUniqueId(), command);
|
confirmMap.put(sender.getUniqueId(), command);
|
||||||
|
|
||||||
TextComponent message = new TextComponent(ChatColor.GREEN + "You are TPing out of spec, run command again to confirm.");
|
TextComponent message = new TextComponent("You are running this command out of spec, run again to confirm.");
|
||||||
|
message.setColor(ChatColor.GREEN);
|
||||||
sender.spigot().sendMessage(message);
|
sender.spigot().sendMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,7 +123,8 @@ public class CommandPreprocessListener implements Listener {
|
||||||
for (LinkCommand linkCommand : QoL.getLinks()) {
|
for (LinkCommand linkCommand : QoL.getLinks()) {
|
||||||
if (base.equalsIgnoreCase(linkCommand.getCommand())) {
|
if (base.equalsIgnoreCase(linkCommand.getCommand())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
TextComponent link = new TextComponent(ChatColor.GREEN + linkCommand.getMessage());
|
TextComponent link = new TextComponent(linkCommand.getMessage());
|
||||||
|
link.setColor(ChatColor.GREEN);
|
||||||
link.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, linkCommand.getUrl()));
|
link.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, linkCommand.getUrl()));
|
||||||
sender.spigot().sendMessage(link);
|
sender.spigot().sendMessage(link);
|
||||||
return;
|
return;
|
||||||
|
@ -153,7 +163,7 @@ public class CommandPreprocessListener implements Listener {
|
||||||
Map<String, String> post = new HashMap<>();
|
Map<String, String> post = new HashMap<>();
|
||||||
post.put("username", username);
|
post.put("username", username);
|
||||||
post.put("content", content);
|
post.put("content", content);
|
||||||
CoreWeb.asyncPost(plugin, webhook, post);
|
Http.asyncPost(plugin, webhook, post);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
package xyz.etztech.qol.listeners;
|
||||||
|
|
||||||
|
import github.scarsz.discordsrv.DiscordSRV;
|
||||||
|
import github.scarsz.discordsrv.api.events.DiscordGuildMessagePreBroadcastEvent;
|
||||||
|
import github.scarsz.discordsrv.api.events.GameChatMessagePreProcessEvent;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import xyz.etztech.qol.EtzTechUtil;
|
||||||
|
import xyz.etztech.qol.Lang;
|
||||||
|
import xyz.etztech.qol.QoL;
|
||||||
|
import github.scarsz.discordsrv.api.Subscribe;
|
||||||
|
import xyz.etztech.qol.commands.DiscordIgnoreCommand;
|
||||||
|
|
||||||
|
public class DiscordSRVListener {
|
||||||
|
private final QoL plugin;
|
||||||
|
|
||||||
|
public DiscordSRVListener(QoL plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
DiscordSRV.api.subscribe(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void gameChatMessagePreProcess(GameChatMessagePreProcessEvent event) {
|
||||||
|
if (QoL.hasSM(event.getPlayer())) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void discordGuildMessagePreBroadcastEvent(DiscordGuildMessagePreBroadcastEvent event) {
|
||||||
|
event.getRecipients().removeIf(recipient -> {
|
||||||
|
if (recipient instanceof Player) {
|
||||||
|
Player player = (Player) recipient;
|
||||||
|
|
||||||
|
return player.hasMetadata(DiscordIgnoreCommand.DISCORD_IGNORE_METADATA);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package xyz.etztech.qol.listeners;
|
||||||
|
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||||
|
import xyz.etztech.qol.QoL;
|
||||||
|
|
||||||
|
public class EntityChangeBlockListener implements Listener {
|
||||||
|
QoL plugin;
|
||||||
|
|
||||||
|
public EntityChangeBlockListener(QoL plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEntityChangeBlock(EntityChangeBlockEvent e) {
|
||||||
|
if (e.getEntity().getType() == EntityType.ENDERMAN) {
|
||||||
|
if(plugin.getConfig().getBoolean("disable-mob-grief.enderman", false)){
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
package xyz.etztech.qol.listeners;
|
||||||
|
|
||||||
|
import com.nisovin.shopkeepers.api.ShopkeepersPlugin;
|
||||||
|
import com.nisovin.shopkeepers.api.shopkeeper.ShopkeeperRegistry;
|
||||||
|
import com.nisovin.shopkeepers.api.shopkeeper.admin.regular.RegularAdminShopkeeper;
|
||||||
|
import com.nisovin.shopkeepers.api.shopkeeper.offers.TradeOffer;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
|
import xyz.etztech.qol.QoL;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class HeadShopListener implements Listener{
|
||||||
|
|
||||||
|
private final QoL plugin;
|
||||||
|
private final ShopkeepersPlugin shopkeepersAPI;
|
||||||
|
|
||||||
|
public HeadShopListener(QoL plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||||
|
|
||||||
|
this.shopkeepersAPI = ShopkeepersPlugin.getInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onJoin(PlayerJoinEvent event) {
|
||||||
|
final Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if (shopkeepersAPI != null && player.hasPermission("qol.head_shop")) {
|
||||||
|
int shopKeeperID = plugin.getConfig().getInt("head_shop.id", -1);
|
||||||
|
|
||||||
|
if (shopKeeperID != -1) {
|
||||||
|
ShopkeeperRegistry shopkeeperRegistry = shopkeepersAPI.getShopkeeperRegistry();
|
||||||
|
RegularAdminShopkeeper donorHeadShop = (RegularAdminShopkeeper) shopkeeperRegistry.getShopkeeperById(shopKeeperID);
|
||||||
|
|
||||||
|
if (donorHeadShop != null) {
|
||||||
|
// Remove the head if it already exists. This is done to refresh the skin of the head.
|
||||||
|
List<? extends TradeOffer> tradeOffers = new ArrayList<>(donorHeadShop.getOffers());
|
||||||
|
tradeOffers.removeIf(tradeOffer -> {
|
||||||
|
SkullMeta itemOfferMeta = (SkullMeta)tradeOffer.getResultItem().getItemMeta();
|
||||||
|
return itemOfferMeta.getOwningPlayer().getUniqueId() == player.getUniqueId();
|
||||||
|
});
|
||||||
|
|
||||||
|
donorHeadShop.setOffers(tradeOffers);
|
||||||
|
|
||||||
|
// Add the head to the shop
|
||||||
|
int diamondPrice = plugin.getConfig().getInt("head_shop.price", 2);
|
||||||
|
ItemStack playerHead = new ItemStack(Material.PLAYER_HEAD);
|
||||||
|
SkullMeta skullMeta = (SkullMeta) playerHead.getItemMeta();
|
||||||
|
|
||||||
|
skullMeta.setOwningPlayer(player);
|
||||||
|
skullMeta.setDisplayName(player.getDisplayName());
|
||||||
|
playerHead.setItemMeta(skullMeta);
|
||||||
|
|
||||||
|
TradeOffer donorHeadTrade = TradeOffer.create(playerHead, new ItemStack(Material.DIAMOND, diamondPrice), null);
|
||||||
|
|
||||||
|
donorHeadShop.addOffer(donorHeadTrade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,12 +2,10 @@ package xyz.etztech.qol.listeners;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerLoginEvent;
|
|
||||||
import xyz.etztech.qol.QoL;
|
import xyz.etztech.qol.QoL;
|
||||||
import xyz.etztech.qol.commands.CheckupCommand;
|
import xyz.etztech.qol.commands.CheckupCommand;
|
||||||
|
|
||||||
|
@ -19,6 +17,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
|
||||||
|
@ -56,8 +55,6 @@ public class JoinListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.updatePlayerViewDistance(player);
|
|
||||||
|
|
||||||
CheckupCommand.join(player);
|
CheckupCommand.join(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
package xyz.etztech.qol.listeners;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.block.BlockIgniteEvent;
|
|
||||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
|
||||||
import xyz.etztech.qol.QoL;
|
|
||||||
|
|
||||||
public class PlayerBucketEmptyListener implements Listener {
|
|
||||||
|
|
||||||
QoL plugin;
|
|
||||||
|
|
||||||
public PlayerBucketEmptyListener(QoL plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
if( event.getBucket() == Material.LAVA_BUCKET) {
|
|
||||||
plugin.getGriefAlert().addAlert(player.getName() + " poured lava.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
package xyz.etztech.qol.listeners;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
|
||||||
import xyz.etztech.qol.QoL;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class PlayerChangedWorldListener implements Listener {
|
|
||||||
QoL plugin;
|
|
||||||
|
|
||||||
public PlayerChangedWorldListener(QoL plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
|
|
||||||
plugin.updatePlayerViewDistance(player);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
package xyz.etztech.qol.other;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import xyz.etztech.core.web.CoreWeb;
|
|
||||||
import xyz.etztech.qol.EtzTechUtil;
|
|
||||||
import xyz.etztech.qol.QoL;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class GriefAlert implements Runnable {
|
|
||||||
private Map<String, Integer> alerts;
|
|
||||||
|
|
||||||
private QoL plugin;
|
|
||||||
|
|
||||||
public GriefAlert(QoL plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
alerts = new HashMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addAlert(String alert) {
|
|
||||||
int num = alerts.getOrDefault(alert, 0);
|
|
||||||
alerts.put(alert, ++num);
|
|
||||||
int lines = plugin.getConfig().getInt("grief-alert.lines", 5);
|
|
||||||
if (num < lines) {
|
|
||||||
alert(alert);
|
|
||||||
} else if (num == lines) {
|
|
||||||
String extra = " Suppressing more alerts for a while";
|
|
||||||
String webhook = plugin.getConfig().getString("grief-alert.webhook", "");
|
|
||||||
String message = "@here " + alert;
|
|
||||||
if (StringUtils.isNotEmpty(webhook)) {
|
|
||||||
extra += " and pinging Discord";
|
|
||||||
Map<String, String> data = new HashMap<>();
|
|
||||||
data.put("username", "Grief Alert");
|
|
||||||
data.put("content", message);
|
|
||||||
CoreWeb.asyncPost(plugin, webhook, data);
|
|
||||||
}
|
|
||||||
extra += "...";
|
|
||||||
alert(alert + extra);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void alert(String alert) {
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
|
||||||
if (player.hasPermission("qol.griefalert")) {
|
|
||||||
EtzTechUtil.sms(player, ChatColor.RED + alert);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
package xyz.etztech.qol.other;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.chat.BaseComponent;
|
||||||
|
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import net.md_5.bungee.api.ChatColor;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Reminder {
|
||||||
|
private final int frequency;
|
||||||
|
private final List<ReminderList> reminderLists;
|
||||||
|
|
||||||
|
public Reminder(int frequency, List<ReminderList> reminderLists) {
|
||||||
|
this.frequency = frequency;
|
||||||
|
this.reminderLists = reminderLists;
|
||||||
|
Collections.sort(reminderLists);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Reminder fromConfig(ConfigurationSection config) {
|
||||||
|
int frequency = config.getInt("frequency");
|
||||||
|
List<ReminderList> reminderLists = new ArrayList();
|
||||||
|
ConfigurationSection reminderGroups = config.getConfigurationSection("reminder_groups");
|
||||||
|
|
||||||
|
for (String groupName: reminderGroups.getKeys(false)) {
|
||||||
|
ConfigurationSection group = reminderGroups.getConfigurationSection(groupName);
|
||||||
|
|
||||||
|
int period = group.getInt("period", 0);
|
||||||
|
ChatColor color = ChatColor.of(group.getString("color", "#3273DC"));
|
||||||
|
List<String> reminders = group.getStringList("reminders");
|
||||||
|
|
||||||
|
reminderLists.add(new ReminderList(reminders, period, color));
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Reminder(frequency, reminderLists);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseComponent[] nextReminder() {
|
||||||
|
BaseComponent[] msg = null;
|
||||||
|
boolean reminderFound = false;
|
||||||
|
for (ReminderList reminderList: reminderLists) {
|
||||||
|
if (!reminderFound && reminderList.isReady()) {
|
||||||
|
msg = new ComponentBuilder().
|
||||||
|
color(reminderList.getColor())
|
||||||
|
.append(reminderList.nextReminder())
|
||||||
|
.create();
|
||||||
|
|
||||||
|
reminderFound = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
reminderList.incCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFrequency() {
|
||||||
|
return frequency;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package xyz.etztech.qol.other;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.ChatColor;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ReminderList implements Comparable<ReminderList>{
|
||||||
|
private final List<String> reminders;
|
||||||
|
private final int period;
|
||||||
|
private final ChatColor color;
|
||||||
|
private int ndx;
|
||||||
|
private int count;
|
||||||
|
|
||||||
|
public ReminderList(List<String> reminders, int period, ChatColor color) {
|
||||||
|
this.reminders = reminders;
|
||||||
|
this.period = period;
|
||||||
|
this.color = color;
|
||||||
|
this.ndx = 0;
|
||||||
|
this.count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void incCount() {
|
||||||
|
count = (count + 1) % (period + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isReady() {
|
||||||
|
return count == period;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String nextReminder() {
|
||||||
|
String nextReminder = reminders.get(ndx);
|
||||||
|
ndx = (ndx + 1) % reminders.size();
|
||||||
|
|
||||||
|
return nextReminder;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(@NotNull ReminderList o) {
|
||||||
|
return Integer.compare(o.period, this.period);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChatColor getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,112 +0,0 @@
|
||||||
package xyz.etztech.qol.other;
|
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
public class ShadowMuteTime {
|
|
||||||
|
|
||||||
private int hours;
|
|
||||||
private int minutes;
|
|
||||||
private int seconds;
|
|
||||||
|
|
||||||
public ShadowMuteTime() {
|
|
||||||
hours = 1;
|
|
||||||
minutes = 0;
|
|
||||||
seconds = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getHours() {
|
|
||||||
return hours;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHours(int hours) {
|
|
||||||
this.hours = hours;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addHours(int hours) {
|
|
||||||
this.hours += hours;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMinutes() {
|
|
||||||
return minutes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMinutes(int minutes) {
|
|
||||||
this.minutes = minutes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addMinutes(int minutes) {
|
|
||||||
this.minutes += minutes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSeconds() {
|
|
||||||
return seconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSeconds(int seconds) {
|
|
||||||
this.seconds = seconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addSeconds(int seconds) {
|
|
||||||
this.seconds += seconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString() {
|
|
||||||
return getHours() + " hours, " + getMinutes() + " minutes, and " + getSeconds() + " seconds";
|
|
||||||
}
|
|
||||||
|
|
||||||
public long toTicks() {
|
|
||||||
int seconds = getSeconds();
|
|
||||||
seconds += getMinutes()*60;
|
|
||||||
seconds += getHours()*60*60;
|
|
||||||
return seconds*20;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ShadowMuteTime parse(String time) throws Exception {
|
|
||||||
ShadowMuteTime smt = new ShadowMuteTime();
|
|
||||||
smt.setHours(0); // Defaults to 1 hour
|
|
||||||
String timePattern = "(?:(?<hours>\\d+)h)?(?:(?<minutes>\\d+)m)?(?:(?<seconds>\\d+)s)?";
|
|
||||||
Pattern pattern = Pattern.compile(timePattern);
|
|
||||||
Matcher match = pattern.matcher(time);
|
|
||||||
|
|
||||||
if (!match.matches()) {
|
|
||||||
throw new Exception("Time format does not match, defaulting to 1 hour.");
|
|
||||||
}
|
|
||||||
|
|
||||||
String hourString = match.group("hours");
|
|
||||||
if (hourString != null) {
|
|
||||||
int hours = Integer.parseInt(hourString);
|
|
||||||
smt.addHours(hours);
|
|
||||||
}
|
|
||||||
|
|
||||||
String minuteString = match.group("minutes");
|
|
||||||
if (minuteString != null) {
|
|
||||||
int minutes = Integer.parseInt(minuteString);
|
|
||||||
if (minutes >= 60) {
|
|
||||||
int toHours = minutes / 60;
|
|
||||||
minutes %= 60;
|
|
||||||
smt.addHours(toHours);
|
|
||||||
}
|
|
||||||
smt.addMinutes(minutes);
|
|
||||||
}
|
|
||||||
|
|
||||||
String secondString = match.group("seconds");
|
|
||||||
if (secondString != null) {
|
|
||||||
int seconds = Integer.parseInt(secondString);
|
|
||||||
if (seconds >= 60) {
|
|
||||||
int toMinutes = seconds / 60;
|
|
||||||
seconds %= 60;
|
|
||||||
int minutes = smt.getMinutes() + toMinutes;
|
|
||||||
if (minutes >= 60) {
|
|
||||||
int toHours = minutes / 60;
|
|
||||||
minutes %= 60;
|
|
||||||
smt.addHours(toHours);
|
|
||||||
}
|
|
||||||
smt.addMinutes(minutes);
|
|
||||||
}
|
|
||||||
smt.addSeconds(seconds);
|
|
||||||
}
|
|
||||||
|
|
||||||
return smt;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +1,11 @@
|
||||||
package xyz.etztech.qol.other;
|
package xyz.etztech.qol.other;
|
||||||
|
|
||||||
import net.ess3.api.IEssentials;
|
import me.lucko.spark.api.statistic.StatisticWindow;
|
||||||
|
import me.lucko.spark.api.statistic.types.DoubleStatistic;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import xyz.etztech.core.web.CoreWeb;
|
import xyz.etztech.core.web.Http;
|
||||||
import xyz.etztech.qol.QoL;
|
import xyz.etztech.qol.QoL;
|
||||||
|
import me.lucko.spark.api.Spark;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -18,19 +20,19 @@ public class TPSRunnable implements Runnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
IEssentials essentials = plugin.getEssentials();
|
Spark spark = plugin.getSpark();
|
||||||
if (essentials != null) {
|
if (spark != null) {
|
||||||
double tps = essentials.getTimer().getAverageTPS();
|
DoubleStatistic<StatisticWindow.TicksPerSecond> tps = spark.tps();
|
||||||
int threshold = plugin.getConfig().getInt("tps.threshold", 0);
|
int threshold = plugin.getConfig().getInt("tps.threshold", 0);
|
||||||
String webhook = plugin.getConfig().getString("tps.webhook", "");
|
String webhook = plugin.getConfig().getString("tps.webhook", "");
|
||||||
String message = "@here TPS has fallen below " + threshold + "!";
|
String message = "@here TPS has fallen below " + threshold + "!";
|
||||||
if (tps < threshold) {
|
if (tps.poll(StatisticWindow.TicksPerSecond.SECONDS_10) < threshold) {
|
||||||
plugin.log(message);
|
plugin.log(message);
|
||||||
if (StringUtils.isNotEmpty(webhook)) {
|
if (StringUtils.isNotEmpty(webhook)) {
|
||||||
Map<String, String> data = new HashMap<>();
|
Map<String, String> data = new HashMap<>();
|
||||||
data.put("username", "TPS Alert");
|
data.put("username", "TPS Alert");
|
||||||
data.put("content", message);
|
data.put("content", message);
|
||||||
CoreWeb.asyncPost(plugin, webhook, data);
|
Http.asyncPost(plugin, webhook, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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:
|
||||||
|
@ -48,9 +43,8 @@ tps:
|
||||||
threshold: 12
|
threshold: 12
|
||||||
webhook: ''
|
webhook: ''
|
||||||
|
|
||||||
grief-alert:
|
# The link to open for portal setup instructions
|
||||||
lines: 5
|
portal-link: 'https://i.imgur.com/tQCbI0C.png'
|
||||||
webhook: ''
|
|
||||||
|
|
||||||
# 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:
|
||||||
|
@ -66,10 +60,19 @@ schedule:
|
||||||
|
|
||||||
# To disable, set minutes to 0
|
# To disable, set minutes to 0
|
||||||
reminders:
|
reminders:
|
||||||
frequency: 5 # In minutes
|
frequency: 1 # In minutes
|
||||||
color: '&a'
|
reminder_groups:
|
||||||
messages:
|
standard:
|
||||||
- 'Check out the Discord!'
|
color: '#3273DC'
|
||||||
|
reminders:
|
||||||
|
- '1st Standard Reminder'
|
||||||
|
- '2nd Standard Reminder'
|
||||||
|
event:
|
||||||
|
color: '#3273DC'
|
||||||
|
period: 2
|
||||||
|
reminders:
|
||||||
|
- '1st Event Reminder'
|
||||||
|
- '2nd Event Reminder'
|
||||||
|
|
||||||
# A list of links for link command aliases, separated by a comma between name and URL
|
# A list of links for link command aliases, separated by a comma between name and URL
|
||||||
links:
|
links:
|
||||||
|
@ -90,6 +93,36 @@ disable-fire:
|
||||||
ender_crystal: false
|
ender_crystal: false
|
||||||
explosion: false
|
explosion: false
|
||||||
|
|
||||||
# Overrides view distance per world, format is [World Name]: [View Distance]
|
disable-mob-grief:
|
||||||
view-distances:
|
enderman: false
|
||||||
# world: 2
|
|
||||||
|
# A list of commands to confirm before using if the user isn't in spectator mode
|
||||||
|
spec-confirm:
|
||||||
|
- "tp"
|
||||||
|
- "checkup"
|
||||||
|
- "lagg tpchunk"
|
||||||
|
|
||||||
|
# Dynmap link
|
||||||
|
# Leave url blank to disable
|
||||||
|
dynmap:
|
||||||
|
# Dynmap marker to use
|
||||||
|
marker_icon: "blueflag"
|
||||||
|
# Name of the marker layer
|
||||||
|
marker_set_label: "QoL Markers"
|
||||||
|
# Show the markers on the map by default
|
||||||
|
marker_set_show: false
|
||||||
|
# Limit to how many markers one player can have
|
||||||
|
url: ""
|
||||||
|
defaults:
|
||||||
|
map: "surface"
|
||||||
|
zoom: 5
|
||||||
|
|
||||||
|
# Shopkeepers Player Head Shop
|
||||||
|
head_shop:
|
||||||
|
# Shopkeeper Shop ID, set to -1 to disable
|
||||||
|
id: -1
|
||||||
|
# Diamond price of a head in the shop, default is 2 diamonds
|
||||||
|
price: 2
|
||||||
|
|
||||||
|
# Base URL for the /wiki command. Should support a https://www.mediawiki.org/wiki/API:Opensearch request
|
||||||
|
wiki-base-url: 'https://minecraft.wiki'
|
||||||
|
|
|
@ -4,18 +4,17 @@ description: ${description}
|
||||||
author: ${author}
|
author: ${author}
|
||||||
website: ${url}
|
website: ${url}
|
||||||
main: ${mainClass}
|
main: ${mainClass}
|
||||||
|
softdepend: [spark, dynmap, DiscordSRV, Shopkeepers]
|
||||||
|
api-version: 1.13
|
||||||
commands:
|
commands:
|
||||||
qol:
|
qol:
|
||||||
description: Base command
|
description: Base command
|
||||||
colors:
|
colors:
|
||||||
description: See all color/formatting codes
|
description: See all color/formatting codes
|
||||||
aliases: [color, c]
|
aliases: [color, c, colour, colours]
|
||||||
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,15 +39,28 @@ 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:
|
||||||
|
description: Dynmap Link command
|
||||||
|
aliases: [dlink]
|
||||||
|
marker:
|
||||||
|
description: Dynmap marker command
|
||||||
|
aliases: [mark]
|
||||||
|
wiki:
|
||||||
|
description: Search the Minecraft wiki
|
||||||
|
moon:
|
||||||
|
description: Get information about the current moon phase
|
||||||
|
discordignore:
|
||||||
|
description: Mute chat messages coming from Discord
|
||||||
|
aliases: [dignore]
|
||||||
permissions:
|
permissions:
|
||||||
qol.admin:
|
qol.admin:
|
||||||
description: Ability to reload the plugin
|
description: Ability to reload the plugin
|
||||||
default: op
|
default: op
|
||||||
|
qol.discord:
|
||||||
|
description: Ability to use limited Discord syntax for chat formatting
|
||||||
|
default: op
|
||||||
qol.priority:
|
qol.priority:
|
||||||
description: Allows a player on past the player cap
|
description: Allows a player on past the player cap
|
||||||
default: op
|
default: op
|
||||||
|
@ -76,23 +88,20 @@ 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
|
||||||
|
qol.dynmaplink:
|
||||||
|
description: Ability to use the Dynmap Link Command
|
||||||
|
default: op
|
||||||
qol.auditable:
|
qol.auditable:
|
||||||
description: Audits command usage
|
description: Audits command usage
|
||||||
default: op
|
default: op
|
||||||
qol.auditor:
|
qol.auditor:
|
||||||
description: Ability to bypass auditing when running commands on auditable
|
description: Ability to bypass auditing when running commands on auditable
|
||||||
default: op
|
default: op
|
||||||
qol.tpconfirm:
|
qol.specconfirm:
|
||||||
description: Makes the user confirm they want to TP out of spec
|
description: Makes the user confirm they want to run (configurable) command(s) out of spec
|
||||||
default: op
|
|
||||||
qol.griefalert:
|
|
||||||
description: Alerts the user when monitored actions are encountered
|
|
||||||
default: op
|
default: op
|
||||||
qol.whitelist.bypass:
|
qol.whitelist.bypass:
|
||||||
description: Allows someone into the server when Whitelist is enabled
|
description: Allows someone into the server when Whitelist is enabled
|
||||||
|
@ -110,5 +119,20 @@ permissions:
|
||||||
default: op
|
default: op
|
||||||
children:
|
children:
|
||||||
qol.timeout.bypass: true
|
qol.timeout.bypass: true
|
||||||
|
qol.marker:
|
||||||
|
description: Ability to use the marker command
|
||||||
|
default: op
|
||||||
|
children:
|
||||||
|
qol.marker.limit: true
|
||||||
|
qol.wiki:
|
||||||
|
description: Ability to use the wiki command
|
||||||
|
default: op
|
||||||
|
qol.moon:
|
||||||
|
description: Ability to use the moon command
|
||||||
|
default: op
|
||||||
|
qol.discordignore:
|
||||||
|
description: Ability to use the use the discordignore command
|
||||||
|
default: op
|
||||||
|
qol.head_shop:
|
||||||
|
description: Controls if a player's head should be added to the head shop
|
||||||
|
default: op
|
||||||
|
|
Loading…
Reference in New Issue