This commit is contained in:
Telesphoreo 2020-08-21 21:57:54 -05:00
commit f244d4381e
21 changed files with 155 additions and 235 deletions

View file

@ -1,101 +0,0 @@
---
name: Bug/Issue report for PlotSquared
about: Bug / Issue report about this plugin
title: ''
labels: "[?] Testing Required"
assignees: ''
---
<!--- READ THIS BEFORE SUBMITTING AN ISSUE REPORT!!! -->
<!--- ##### DO NOT REMOVE THIS TEMPLATE! YOUR ISSUE *WILL* FIT IN IT! ##### -->
<!--- # NOTICE:
**Feature requests & Suggestions are to be submitted at the [PlotSquared Suggestions tracker](https://github.com/IntellectualSites/PlotSquaredSuggestions)**
**Code contributions are to be done through [PRs](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request), tagging the specific issue ticket(s) if applicable.**
**[DISCORD INVITE LINK](https://discord.gg/KxkjDVg)**
-->
# Bug Report Template:
<!--- Incomplete reports will most likely be marked as invalid, and closed, with few exceptions.-->
## Required Information section:
> ALL FIELDS IN THIS SECTION ARE REQUIRED, and must contain appropriate information
### Server config info (/plot debugpaste / file paste links):
<!--- Issue /plot debugpaste in game or in your console and copy the supplied URL here -->
<!--- If you cannot perform the above, we require logs/latest.log; settings.yml; worlds.yml and possibly PlotSquared.use_THIS.yml -->
<!--- If you are unwilling to supply the information we need, we reserve the right to not assist you. Redact IP addresses if you need to. -->
**/plot debugpaste:**
### Server type:
**Select one**
<!-- Select the type you are reporting the issue for (put an "X" between of brackets): -->
- [] Spigot / Paper *(CraftBukkit should not be used, re-test with Spigot first!)*
- [] Sponge
- [] NukkitX
### PlotSquared version:
<!-- Run /plot plugin in-game or in console & paste the full output here: -->
```
Paste the output here, between the tick marks, replacing this text
```
### Minecraft Version:
**Select one**
<!-- Select the type you are reporting the issue for (put an "X" between of brackets) -->
- [] Minecraft 1.15.2
- [] Minecraft 1.14.4
- [] Minecraft 1.13.2
- [] Minecraft 1.12.2
- [] Minecraft 1.11.2
- [] Minecraft 1.10.2
- [] Minecraft 1.9.4
- [] Minecraft 1.8.8
- [] Minecraft Java Edition *other versions, please specify*:
- [] Minecraft Bedrock Edition *specify version*:
- [] Minecraft Sponge *specify version*:
### Server build info:
<!--- Run /version in-game or in console & paste the full output here: -->
```
Paste the output here, between the tick marks, replacing this text
```
### WorldEdit/FAWE versions:
<!--- Specify which plugin you are using, and add its version. Either use /fawe version or /we version -->
- [] FAWE version:
- [] WorldEdit version:
### Description of the problem:
<!--- Be as specific as possible. Don't lie, redact information, or use false names/situations. -->
<!--- Who, What, When, Where, Why, How, Expected behavior, Resultant behavior, etc -->
### How to replicate:
<!--- If you can reproduce the issue please tell us as detailed as possible step by step how to do that -->
## Additional Information:
> The information here is optional for you to provide, however it may help us to more readily diagnose any compatibility and bug issues.
### Other plugins being used on the server:
<!--- Optional but recommended - issue "/plugins" in-game or in console and copy/paste the list -->
### Relevant console output, log lines, and/or screenshots:
<!--- Please use in-line code insertion
```
like this
```
for short (20 lines or less) text blobs, or a paste service for large blobs -->
### Additional relevant comments/remarks:
<!--- Use this space to give us any additional information which may be relevant to this issue, such as: if you are using a Minecraft hosting provider; unusual installation environment; etc -->
# AFFIRMATION OF COMPLETION:
<!-- Make sure you have completed the following steps (put an "X" between of brackets): -->
- [] I included all information required in the sections above
- [] I made sure there are no duplicates of this report [(Use Search)](https://github.com/IntellectualSites/PlotSquared/issues?utf8=%E2%9C%93&q=is%3Aissue)
- [] I made sure I am using an up-to-date version of PlotSquared
- [] I made sure the bug/error is not caused by any other plugin
- [x] I didn't read but checked everything above.

View file

@ -1,8 +0,0 @@
blank_issues_enabled: false
contact_links:
- name: PlotSquared Issue Tracker
url: https://issues.intellectualsites.com/projects/ps
about: Click here to move to our new issue tracker
- name: PlotSquared Suggestions
url: https://github.com/IntellectualSites/PlotSquaredSuggestions
about: If you want to submit feature or suggestion ideas, do that here

View file

@ -6,7 +6,7 @@ repositories {
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" } maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url = "https://jitpack.io" } maven { url = "https://jitpack.io" }
maven { url = "https://repo.codemc.org/repository/maven-public" } maven { url = "https://repo.codemc.org/repository/maven-public" }
maven { url = "http://repo.extendedclip.com/content/repositories/placeholderapi/" } maven { url = "https://repo.extendedclip.com/content/repositories/placeholderapi/" }
maven { maven {
name = "papermc" name = "papermc"
url = "https://papermc.io/repo/repository/maven-public/" url = "https://papermc.io/repo/repository/maven-public/"
@ -23,8 +23,8 @@ dependencies {
implementation(project(":PlotSquared-Core")) implementation(project(":PlotSquared-Core"))
compile("org.bstats:bstats-bukkit:1.7") compile("org.bstats:bstats-bukkit:1.7")
compile(project(":PlotSquared-Core")) compile(project(":PlotSquared-Core"))
compile("com.destroystokyo.paper:paper-api:1.16.1-R0.1-SNAPSHOT") compile("com.destroystokyo.paper:paper-api:1.16.2-R0.1-SNAPSHOT")
implementation("org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT") implementation("org.spigotmc:spigot-api:1.16.2-R0.1-SNAPSHOT")
compile(group: "com.sk89q.worldedit", name: "worldedit-bukkit", version: "7.1.0") { compile(group: "com.sk89q.worldedit", name: "worldedit-bukkit", version: "7.1.0") {
exclude(module: "bukkit") exclude(module: "bukkit")
@ -36,7 +36,7 @@ dependencies {
} }
implementation("me.clip:placeholderapi:2.10.6") implementation("me.clip:placeholderapi:2.10.6")
implementation("net.luckperms:api:5.1") implementation("net.luckperms:api:5.1")
implementation("net.ess3:EssentialsX:2.17.2") { implementation("net.ess3:EssentialsX:2.18.0") {
exclude(group: "io.papermc", module: "paperlib") exclude(group: "io.papermc", module: "paperlib")
} }
implementation("net.alpenblock:BungeePerms:4.0-dev-106") implementation("net.alpenblock:BungeePerms:4.0-dev-106")

View file

@ -27,7 +27,7 @@
<dependency> <dependency>
<groupId>com.destroystokyo.paper</groupId> <groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId> <artifactId>paper-api</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version> <version>1.16.2-R0.1-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -149,7 +149,7 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version> <version>1.16.2-R0.1-SNAPSHOT</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -179,7 +179,7 @@
<dependency> <dependency>
<groupId>net.ess3</groupId> <groupId>net.ess3</groupId>
<artifactId>EssentialsX</artifactId> <artifactId>EssentialsX</artifactId>
<version>2.17.2</version> <version>2.18.0</version>
<scope>runtime</scope> <scope>runtime</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>

View file

@ -770,6 +770,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain<
} }
continue; continue;
case "ZOMBIFIED_PIGLIN": case "ZOMBIFIED_PIGLIN":
case "PIGLIN_BRUTE":
case "LLAMA": case "LLAMA":
case "DONKEY": case "DONKEY":
case "MULE": case "MULE":

View file

@ -310,6 +310,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
case "HOGLIN": case "HOGLIN":
case "ZOMBIFIED_PIGLIN": case "ZOMBIFIED_PIGLIN":
case "PIGLIN": case "PIGLIN":
case "PIGLIN_BRUTE":
case "ZOMBIE": case "ZOMBIE":
case "WITHER": case "WITHER":
case "WITCH": case "WITCH":
@ -711,6 +712,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
case "HOGLIN": case "HOGLIN":
case "PIGLIN": case "PIGLIN":
case "ZOMBIFIED_PIGLIN": case "ZOMBIFIED_PIGLIN":
case "PIGLIN_BRUTE":
case "ZOMBIE": case "ZOMBIE":
case "WITHER": case "WITHER":
case "WITCH": case "WITCH":

View file

@ -69,6 +69,7 @@ import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.PremiumVerification; import com.plotsquared.core.util.PremiumVerification;
import com.plotsquared.core.util.ReflectionUtils;
import com.plotsquared.core.util.RegExUtil; import com.plotsquared.core.util.RegExUtil;
import com.plotsquared.core.util.entity.EntityCategories; import com.plotsquared.core.util.entity.EntityCategories;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
@ -139,6 +140,7 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.function.Predicate;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
@ -153,7 +155,15 @@ public class PlayerEventListener extends PlotListener implements Listener {
private PlayerMoveEvent moveTmp; private PlayerMoveEvent moveTmp;
private String internalVersion; private String internalVersion;
private final Predicate<Player> isRealPlayerCheck;
{ {
Class<?> playerImplementation = ReflectionUtils.getCbClass("entity.CraftPlayer");
if (playerImplementation == null) {
isRealPlayerCheck = p -> true;
} else {
isRealPlayerCheck = p -> p.getClass() == playerImplementation;
}
try { try {
fieldPlayer = PlayerEvent.class.getDeclaredField("player"); fieldPlayer = PlayerEvent.class.getDeclaredField("player");
fieldPlayer.setAccessible(true); fieldPlayer.setAccessible(true);
@ -346,6 +356,9 @@ public class PlayerEventListener extends PlotListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onTeleport(PlayerTeleportEvent event) { public void onTeleport(PlayerTeleportEvent event) {
if (!isRealPlayerCheck.test(event.getPlayer())) {
return;
}
Player player = event.getPlayer(); Player player = event.getPlayer();
BukkitPlayer pp = BukkitUtil.getPlayer(player); BukkitPlayer pp = BukkitUtil.getPlayer(player);
Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT); Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT);
@ -452,6 +465,9 @@ public class PlayerEventListener extends PlotListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void playerMove(PlayerMoveEvent event) { public void playerMove(PlayerMoveEvent event) {
if (!isRealPlayerCheck.test(event.getPlayer())) {
return;
}
org.bukkit.Location from = event.getFrom(); org.bukkit.Location from = event.getFrom();
org.bukkit.Location to = event.getTo(); org.bukkit.Location to = event.getTo();
int x2; int x2;
@ -643,6 +659,9 @@ public class PlayerEventListener extends PlotListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onWorldChanged(PlayerChangedWorldEvent event) { public void onWorldChanged(PlayerChangedWorldEvent event) {
if (!isRealPlayerCheck.test(event.getPlayer())) {
return;
}
Player player = event.getPlayer(); Player player = event.getPlayer();
BukkitPlayer pp = BukkitUtil.getPlayer(player); BukkitPlayer pp = BukkitUtil.getPlayer(player);
// Delete last location // Delete last location

View file

@ -63,11 +63,11 @@ public class OfflinePlayerUtil {
Object profile = newGameProfile(id, name); Object profile = newGameProfile(id, name);
Class<?> entityPlayerClass = getNmsClass("EntityPlayer"); Class<?> entityPlayerClass = getNmsClass("EntityPlayer");
Constructor entityPlayerConstructor = Constructor entityPlayerConstructor =
makeConstructor(entityPlayerClass, getNmsClass("MinecraftServer"), makeConstructor(entityPlayerClass, getNmsClass("MinecraftServer"),
getNmsClass("WorldServer"), getUtilClass("com.mojang.authlib.GameProfile"), getNmsClass("WorldServer"), getUtilClass("com.mojang.authlib.GameProfile"),
getNmsClass("PlayerInteractManager")); getNmsClass("PlayerInteractManager"));
Object entityPlayer = Object entityPlayer =
callConstructor(entityPlayerConstructor, server, worldServer, profile, interactManager); callConstructor(entityPlayerConstructor, server, worldServer, profile, interactManager);
return (Player) getBukkitEntity(entityPlayer); return (Player) getBukkitEntity(entityPlayer);
} }
@ -97,6 +97,26 @@ public class OfflinePlayerUtil {
return callConstructor(c, worldServer); return callConstructor(c, worldServer);
} }
public static Object getWorldServer116() {
Object server = getMinecraftServer();
Class<?> minecraftServerClass = getNmsClass("MinecraftServer");
Class<?> genericResourceKey = getNmsClass("ResourceKey");
Class<?> minecraftKey = getNmsClass("MinecraftKey");
// MinecraftKey + MinecraftKey -> ResourceKey
Method constructResourceKey = makeMethod(genericResourceKey, "a", minecraftKey, minecraftKey);
// MinecraftKey(String)
Constructor<Object> minecraftKeyConstructor = makeConstructor(minecraftKey, String.class);
// minecraft:overworld
Object overworldKey = callConstructor(minecraftKeyConstructor, "overworld");
// minecraft:dimension
Object dimensionKey = callConstructor(minecraftKeyConstructor, "dimension");
// ResourceKey[minecraft:dimension / minecraft:overworld]
Object resourceKey = callMethod(constructResourceKey, null, dimensionKey, overworldKey);
Method getWorldServer =
makeMethod(minecraftServerClass, "getWorldServer", genericResourceKey);
return callMethod(getWorldServer, server, resourceKey);
}
public static Object getWorldServerNew() { public static Object getWorldServerNew() {
Object server = getMinecraftServer(); Object server = getMinecraftServer();
Class<?> minecraftServerClass = getNmsClass("MinecraftServer"); Class<?> minecraftServerClass = getNmsClass("MinecraftServer");
@ -115,7 +135,11 @@ public class OfflinePlayerUtil {
try { try {
o = callMethod(getWorldServer, server, 0); o = callMethod(getWorldServer, server, 0);
} catch (final RuntimeException e) { } catch (final RuntimeException e) {
o = getWorldServerNew(); try {
o = getWorldServerNew();
} catch (final RuntimeException f) {
o = getWorldServer116();
}
} }
return o; return o;
} }

View file

@ -35,11 +35,11 @@ import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.uuid.UUIDMapping;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.UUID;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
@ -79,44 +79,49 @@ public class Add extends Command {
} else { } else {
try { try {
checkTrue(!uuids.isEmpty(), Captions.INVALID_PLAYER, args[0]); checkTrue(!uuids.isEmpty(), Captions.INVALID_PLAYER, args[0]);
Iterator<UUID> iterator = uuids.iterator();
Iterator<UUIDMapping> iterator = uuids.iterator();
int size = plot.getTrusted().size() + plot.getMembers().size(); int size = plot.getTrusted().size() + plot.getMembers().size();
while (iterator.hasNext()) { while (iterator.hasNext()) {
UUID uuid = iterator.next(); UUIDMapping uuidMapping = iterator.next();
if (uuid == DBFunc.EVERYONE && !( if (uuidMapping.getUuid() == DBFunc.EVERYONE && !(
Permissions.hasPermission(player, Captions.PERMISSION_TRUST_EVERYONE) || Permissions Permissions.hasPermission(player, Captions.PERMISSION_TRUST_EVERYONE) || Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST))) { .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST))) {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, MainUtil.getName(uuid)); MainUtil.sendMessage(player, Captions.ALREADY_ADDED, uuidMapping.getUsername());
iterator.remove(); iterator.remove();
continue; continue;
} }
if (plot.isOwner(uuid)) { if (plot.isOwner(uuidMapping.getUuid())) {
MainUtil.sendMessage(player, Captions.ALREADY_ADDED, MainUtil.getName(uuid)); new Thread(() ->
MainUtil.sendMessage(player, Captions.ALREADY_ADDED, uuidMapping.getUsername())
).start();
iterator.remove(); iterator.remove();
continue; continue;
} }
if (plot.getMembers().contains(uuid)) { if (plot.getMembers().contains(uuidMapping.getUuid())) {
MainUtil.sendMessage(player, Captions.ALREADY_ADDED, MainUtil.getName(uuid)); new Thread(() ->
MainUtil.sendMessage(player, Captions.ALREADY_ADDED, uuidMapping.getUsername())
).start();
iterator.remove(); iterator.remove();
continue; continue;
} }
size += plot.getTrusted().contains(uuid) ? 0 : 1; size += plot.getTrusted().contains(uuidMapping.getUuid()) ? 0 : 1;
} }
checkTrue(!uuids.isEmpty(), null); checkTrue(!uuids.isEmpty(), null);
checkTrue(size <= plot.getArea().getMaxPlotMembers() || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST), checkTrue(size <= plot.getArea().getMaxPlotMembers() || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST),
Captions.PLOT_MAX_MEMBERS); Captions.PLOT_MAX_MEMBERS);
// Success // Success
confirm.run(this, () -> { confirm.run(this, () -> {
for (UUID uuid : uuids) { for (UUIDMapping uuidMapping : uuids) {
if (uuid != DBFunc.EVERYONE) { if (uuidMapping.getUuid() != DBFunc.EVERYONE) {
if (!plot.removeTrusted(uuid)) { if (!plot.removeTrusted(uuidMapping.getUuid())) {
if (plot.getDenied().contains(uuid)) { if (plot.getDenied().contains(uuidMapping.getUuid())) {
plot.removeDenied(uuid); plot.removeDenied(uuidMapping.getUuid());
} }
} }
} }
plot.addMember(uuid); plot.addMember(uuidMapping.getUuid());
PlotSquared.get().getEventDispatcher().callMember(player, plot, uuid, true); PlotSquared.get().getEventDispatcher().callMember(player, plot, uuidMapping.getUuid(), true);
MainUtil.sendMessage(player, Captions.MEMBER_ADDED); MainUtil.sendMessage(player, Captions.MEMBER_ADDED);
} }
}, null); }, null);

View file

@ -35,11 +35,11 @@ import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.uuid.UUIDMapping;
import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.gamemode.GameModes;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.UUID;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
@CommandDeclaration(command = "deny", @CommandDeclaration(command = "deny",
@ -77,26 +77,26 @@ public class Deny extends SubCommand {
} else if (throwable != null || uuids.isEmpty()) { } else if (throwable != null || uuids.isEmpty()) {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]); MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
} else { } else {
for (UUID uuid : uuids) { for (UUIDMapping uuidMapping : uuids) {
if (uuid == DBFunc.EVERYONE && !( if (uuidMapping.getUuid() == DBFunc.EVERYONE && !(
Permissions.hasPermission(player, Captions.PERMISSION_DENY_EVERYONE) || Permissions Permissions.hasPermission(player, Captions.PERMISSION_DENY_EVERYONE) || Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DENY))) { .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DENY))) {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, MainUtil.getName(uuid)); MainUtil.sendMessage(player, Captions.INVALID_PLAYER, uuidMapping.getUsername());
} else if (plot.isOwner(uuid)) { } else if (plot.isOwner(uuidMapping.getUuid())) {
MainUtil.sendMessage(player, Captions.CANT_REMOVE_OWNER, MainUtil.getName(uuid)); MainUtil.sendMessage(player, Captions.CANT_REMOVE_OWNER, uuidMapping.getUsername());
return; return;
} else if (plot.getDenied().contains(uuid)) { } else if (plot.getDenied().contains(uuidMapping.getUuid())) {
MainUtil.sendMessage(player, Captions.ALREADY_ADDED, MainUtil.getName(uuid)); MainUtil.sendMessage(player, Captions.ALREADY_ADDED, uuidMapping.getUsername());
return; return;
} else { } else {
if (uuid != DBFunc.EVERYONE) { if (uuidMapping.getUuid() != DBFunc.EVERYONE) {
plot.removeMember(uuid); plot.removeMember(uuidMapping.getUuid());
plot.removeTrusted(uuid); plot.removeTrusted(uuidMapping.getUuid());
} }
plot.addDenied(uuid); plot.addDenied(uuidMapping.getUuid());
PlotSquared.get().getEventDispatcher().callDenied(player, plot, uuid, true); PlotSquared.get().getEventDispatcher().callDenied(player, plot, uuidMapping.getUuid(), true);
if (!uuid.equals(DBFunc.EVERYONE)) { if (!uuidMapping.equals(DBFunc.EVERYONE)) {
handleKick(PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid), plot); handleKick(PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuidMapping.getUuid()), plot);
} else { } else {
for (PlotPlayer plotPlayer : plot.getPlayersInPlot()) { for (PlotPlayer plotPlayer : plot.getPlayersInPlot()) {
// Ignore plot-owners // Ignore plot-owners

View file

@ -35,12 +35,12 @@ import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.uuid.UUIDMapping;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
@CommandDeclaration(command = "kick", @CommandDeclaration(command = "kick",
@ -75,8 +75,8 @@ public class Kick extends SubCommand {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]); MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
} else { } else {
Set<PlotPlayer<?>> players = new HashSet<>(); Set<PlotPlayer<?>> players = new HashSet<>();
for (UUID uuid : uuids) { for (UUIDMapping uuidMapping : uuids) {
if (uuid == DBFunc.EVERYONE) { if (uuidMapping.getUuid() == DBFunc.EVERYONE) {
for (PlotPlayer<?> pp : plot.getPlayersInPlot()) { for (PlotPlayer<?> pp : plot.getPlayersInPlot()) {
if (pp == player || Permissions if (pp == player || Permissions
.hasPermission(pp, Captions.PERMISSION_ADMIN_ENTRY_DENIED)) { .hasPermission(pp, Captions.PERMISSION_ADMIN_ENTRY_DENIED)) {
@ -86,7 +86,7 @@ public class Kick extends SubCommand {
} }
continue; continue;
} }
PlotPlayer<?> pp = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid); PlotPlayer<?> pp = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuidMapping.getUuid());
if (pp != null) { if (pp != null) {
players.add(pp); players.add(pp);
} }

View file

@ -34,10 +34,10 @@ import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.uuid.UUIDMapping;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.UUID;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
@CommandDeclaration(command = "remove", @CommandDeclaration(command = "remove",
@ -78,37 +78,37 @@ public class Remove extends SubCommand {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]); MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
return; return;
} else if (!uuids.isEmpty()) { } else if (!uuids.isEmpty()) {
for (UUID uuid : uuids) { for (UUIDMapping uuidMapping : uuids) {
if (plot.getTrusted().contains(uuid)) { if (plot.getTrusted().contains(uuidMapping.getUuid())) {
if (plot.removeTrusted(uuid)) { if (plot.removeTrusted(uuidMapping.getUuid())) {
PlotSquared.get().getEventDispatcher() PlotSquared.get().getEventDispatcher()
.callTrusted(player, plot, uuid, false); .callTrusted(player, plot, uuidMapping.getUuid(), false);
count++; count++;
} }
} else if (plot.getMembers().contains(uuid)) { } else if (plot.getMembers().contains(uuidMapping.getUuid())) {
if (plot.removeMember(uuid)) { if (plot.removeMember(uuidMapping.getUuid())) {
PlotSquared.get().getEventDispatcher() PlotSquared.get().getEventDispatcher()
.callMember(player, plot, uuid, false); .callMember(player, plot, uuidMapping.getUuid(), false);
count++; count++;
} }
} else if (plot.getDenied().contains(uuid)) { } else if (plot.getDenied().contains(uuidMapping.getUuid())) {
if (plot.removeDenied(uuid)) { if (plot.removeDenied(uuidMapping.getUuid())) {
PlotSquared.get().getEventDispatcher() PlotSquared.get().getEventDispatcher()
.callDenied(player, plot, uuid, false); .callDenied(player, plot, uuidMapping.getUuid(), false);
count++; count++;
} }
} else if (uuid == DBFunc.EVERYONE) { } else if (uuidMapping.getUuid() == DBFunc.EVERYONE) {
if (plot.removeTrusted(uuid)) { if (plot.removeTrusted(uuidMapping.getUuid())) {
PlotSquared.get().getEventDispatcher() PlotSquared.get().getEventDispatcher()
.callTrusted(player, plot, uuid, false); .callTrusted(player, plot, uuidMapping.getUuid(), false);
count++; count++;
} else if (plot.removeMember(uuid)) { } else if (plot.removeMember(uuidMapping.getUuid())) {
PlotSquared.get().getEventDispatcher() PlotSquared.get().getEventDispatcher()
.callMember(player, plot, uuid, false); .callMember(player, plot, uuidMapping.getUuid(), false);
count++; count++;
} else if (plot.removeDenied(uuid)) { } else if (plot.removeDenied(uuidMapping.getUuid())) {
PlotSquared.get().getEventDispatcher() PlotSquared.get().getEventDispatcher()
.callDenied(player, plot, uuid, false); .callDenied(player, plot, uuidMapping.getUuid(), false);
count++; count++;
} }
} }

View file

@ -35,11 +35,11 @@ import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.uuid.UUIDMapping;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.UUID;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
@ -81,28 +81,28 @@ public class Trust extends Command {
return; return;
} else { } else {
checkTrue(!uuids.isEmpty(), Captions.INVALID_PLAYER, args[0]); checkTrue(!uuids.isEmpty(), Captions.INVALID_PLAYER, args[0]);
Iterator<UUID> iterator = uuids.iterator(); Iterator<UUIDMapping> iterator = uuids.iterator();
int size = currentPlot.getTrusted().size() + currentPlot.getMembers().size(); int size = currentPlot.getTrusted().size() + currentPlot.getMembers().size();
while (iterator.hasNext()) { while (iterator.hasNext()) {
UUID uuid = iterator.next(); UUIDMapping uuidMapping = iterator.next();
if (uuid == DBFunc.EVERYONE && !( if (uuidMapping.getUuid() == DBFunc.EVERYONE && !(
Permissions.hasPermission(player, Captions.PERMISSION_TRUST_EVERYONE) || Permissions Permissions.hasPermission(player, Captions.PERMISSION_TRUST_EVERYONE) || Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST))) { .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST))) {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, MainUtil.getName(uuid)); MainUtil.sendMessage(player, Captions.INVALID_PLAYER, uuidMapping.getUsername());
iterator.remove(); iterator.remove();
continue; continue;
} }
if (currentPlot.isOwner(uuid)) { if (currentPlot.isOwner(uuidMapping.getUuid())) {
MainUtil.sendMessage(player, Captions.ALREADY_ADDED, MainUtil.getName(uuid)); MainUtil.sendMessage(player, Captions.ALREADY_ADDED, uuidMapping.getUsername());
iterator.remove(); iterator.remove();
continue; continue;
} }
if (currentPlot.getTrusted().contains(uuid)) { if (currentPlot.getTrusted().contains(uuidMapping.getUuid())) {
MainUtil.sendMessage(player, Captions.ALREADY_ADDED, MainUtil.getName(uuid)); MainUtil.sendMessage(player, Captions.ALREADY_ADDED, uuidMapping.getUsername());
iterator.remove(); iterator.remove();
continue; continue;
} }
size += currentPlot.getMembers().contains(uuid) ? 0 : 1; size += currentPlot.getMembers().contains(uuidMapping.getUuid()) ? 0 : 1;
} }
checkTrue(!uuids.isEmpty(), null); checkTrue(!uuids.isEmpty(), null);
checkTrue(size <= currentPlot.getArea().getMaxPlotMembers() || Permissions checkTrue(size <= currentPlot.getArea().getMaxPlotMembers() || Permissions
@ -110,16 +110,16 @@ public class Trust extends Command {
Captions.PLOT_MAX_MEMBERS); Captions.PLOT_MAX_MEMBERS);
// Success // Success
confirm.run(this, () -> { confirm.run(this, () -> {
for (UUID uuid : uuids) { for (UUIDMapping uuidMapping : uuids) {
if (uuid != DBFunc.EVERYONE) { if (uuidMapping.getUuid() != DBFunc.EVERYONE) {
if (!currentPlot.removeMember(uuid)) { if (!currentPlot.removeMember(uuidMapping.getUuid())) {
if (currentPlot.getDenied().contains(uuid)) { if (currentPlot.getDenied().contains(uuidMapping.getUuid())) {
currentPlot.removeDenied(uuid); currentPlot.removeDenied(uuidMapping.getUuid());
} }
} }
} }
currentPlot.addTrusted(uuid); currentPlot.addTrusted(uuidMapping.getUuid());
PlotSquared.get().getEventDispatcher().callTrusted(player, currentPlot, uuid, true); PlotSquared.get().getEventDispatcher().callTrusted(player, currentPlot, uuidMapping.getUuid(), true);
MainUtil.sendMessage(player, Captions.TRUSTED_ADDED); MainUtil.sendMessage(player, Captions.TRUSTED_ADDED);
} }
}, null); }, null);

View file

@ -180,7 +180,9 @@ public class Visit extends Command {
Captions.COMMAND_SYNTAX.send(player, getUsage()); Captions.COMMAND_SYNTAX.send(player, getUsage());
} else { } else {
final UUID uuid = uuids.toArray(new UUID[0])[0]; final UUID uuid = uuids.toArray(new UUID[0])[0];
this.visit(player, PlotQuery.newQuery().ownedBy(uuid).whereBasePlot(), finalSortByArea, confirm, whenDone, finalPage1); this.visit(player, PlotQuery.newQuery()
.thatPasses(plot -> plot.isOwner(uuid)),
finalSortByArea, confirm, whenDone, finalPage1);
} }
}); });
break; break;
@ -209,7 +211,7 @@ public class Visit extends Command {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, finalArgs[0]); MainUtil.sendMessage(player, Captions.INVALID_PLAYER, finalArgs[0]);
} }
} else { } else {
this.visit(player, PlotQuery.newQuery().ownedBy(uuid).whereBasePlot(), null, confirm, whenDone, finalPage); this.visit(player, PlotQuery.newQuery().thatPasses(plot -> plot.isOwner(uuid)).whereBasePlot(), null, confirm, whenDone, finalPage);
} }
}); });
} else { } else {
@ -262,27 +264,4 @@ public class Visit extends Command {
return completions; return completions;
} }
private void completeNumbers(final List<Command> commands, final String arg, final int start) {
for (int i = 0; i < 100; i++) {
final String command = Integer.toString(start + 1);
if (!command.toLowerCase().startsWith(arg.toLowerCase())) {
continue;
}
commands.add(new Command(this, false, command, "",
RequiredType.NONE, CommandCategory.TELEPORT) {});
}
}
private void completeAreas(final List<Command> commands, final String arg) {
for (final PlotArea area : PlotSquared.get().getPlotAreas()) {
final String areaName = area.getWorldName() + ";" + area.getId();
if (!areaName.toLowerCase().startsWith(arg.toLowerCase())) {
continue;
}
commands.add(new Command(this, false, area.getWorldName() + ";" + area.getId(), "",
RequiredType.NONE, CommandCategory.TELEPORT) {});
}
}
} }

View file

@ -748,10 +748,9 @@ public class MainUtil {
return ratings; return ratings;
} }
public static void getUUIDsFromString(final String list, final BiConsumer<Collection<UUID>, Throwable> consumer) { public static void getUUIDsFromString(final String list, final BiConsumer<Collection<UUIDMapping>, Throwable> consumer) {
String[] split = list.split(","); String[] split = list.split(",");
final Set<UUIDMapping> result = new HashSet<>();
final Set<UUID> result = new HashSet<>();
final List<String> request = new LinkedList<>(); final List<String> request = new LinkedList<>();
for (final String name : split) { for (final String name : split) {
@ -759,10 +758,10 @@ public class MainUtil {
consumer.accept(Collections.emptySet(), null); consumer.accept(Collections.emptySet(), null);
return; return;
} else if ("*".equals(name)) { } else if ("*".equals(name)) {
result.add(DBFunc.EVERYONE); result.add(new UUIDMapping(DBFunc.EVERYONE, "*"));
} else if (name.length() > 16) { } else if (name.length() > 16) {
try { try {
result.add(UUID.fromString(name)); result.add(new UUIDMapping(UUID.fromString(name), name));
} catch (IllegalArgumentException ignored) { } catch (IllegalArgumentException ignored) {
consumer.accept(Collections.emptySet(), null); consumer.accept(Collections.emptySet(), null);
return; return;
@ -776,16 +775,14 @@ public class MainUtil {
consumer.accept(result, null); consumer.accept(result, null);
} else { } else {
PlotSquared.get().getImpromptuUUIDPipeline().getUUIDs(request, Settings.UUID.NON_BLOCKING_TIMEOUT) PlotSquared.get().getImpromptuUUIDPipeline().getUUIDs(request, Settings.UUID.NON_BLOCKING_TIMEOUT)
.whenComplete((uuids, throwable) -> { .whenComplete((uuids, throwable) -> {
if (throwable != null) { if (throwable != null) {
consumer.accept(null, throwable); consumer.accept(null, throwable);
} else { } else {
for (final UUIDMapping uuid : uuids) { result.addAll(uuids);
result.add(uuid.getUuid()); consumer.accept(result, null);
} }
consumer.accept(result, null); });
}
});
} }
} }

View file

@ -1,5 +1,5 @@
<p align="center"> <p align="center">
<img src="https://i.imgur.com/Kd7N6uf.png"> <img src="https://i.imgur.com/33Y65YL.png" width="300">
</p> </p>
--- ---

View file

@ -133,7 +133,6 @@ subprojects {
relocate("org.json", "com.plotsquared.json") { relocate("org.json", "com.plotsquared.json") {
exclude "org/json/simple/**" exclude "org/json/simple/**"
} }
// relocate('org.mcstats', 'com.plotsquared.stats')
archiveFileName = "${project.name}-${parent.version}.jar" archiveFileName = "${project.name}-${parent.version}.jar"
destinationDirectory = file "../target" destinationDirectory = file "../target"
} }

Binary file not shown.

View file

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

2
gradlew vendored
View file

@ -82,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"` APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"` JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath # We build the pattern for arguments to be converted via cygpath

1
gradlew.bat vendored
View file

@ -84,6 +84,7 @@ set CMD_LINE_ARGS=%*
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%