mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-10 09:34:43 +02:00
Compare commits
17 Commits
6.6.0
...
refactor/v
Author | SHA1 | Date | |
---|---|---|---|
676ca9fdf1 | |||
efc2083798 | |||
3a6f845c01 | |||
7efd42ae45 | |||
f43f4cbf5d | |||
104cc4b7a4 | |||
218be43143 | |||
308dba5601 | |||
5f233bb5d1 | |||
5e188d114f | |||
660e05d27f | |||
4c0ad148bf | |||
5c7bfb988c | |||
b46f486680 | |||
05797d0c78 | |||
36ef2cf9ba | |||
26ec31a012 |
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@ -8,11 +8,11 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3.0.0
|
||||||
- name: Validate Gradle Wrapper"
|
- name: Validate Gradle Wrapper"
|
||||||
uses: gradle/wrapper-validation-action@v1
|
uses: gradle/wrapper-validation-action@v1.0.4
|
||||||
- name: Setup Java
|
- name: Setup Java
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3.0.0
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 17
|
java-version: 17
|
||||||
|
2
.github/workflows/codeql.yml
vendored
2
.github/workflows/codeql.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v1
|
uses: github/codeql-action/init@v1
|
||||||
|
2
.github/workflows/release-drafter.yml
vendored
2
.github/workflows/release-drafter.yml
vendored
@ -14,6 +14,6 @@ jobs:
|
|||||||
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: release-drafter/release-drafter@v5
|
- uses: release-drafter/release-drafter@v5.19.0
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
@ -76,7 +76,6 @@ import com.plotsquared.core.util.EventDispatcher;
|
|||||||
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.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;
|
||||||
import com.plotsquared.core.util.task.TaskTime;
|
import com.plotsquared.core.util.task.TaskTime;
|
||||||
@ -223,10 +222,9 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("StringSplitter")
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
public void playerCommand(PlayerCommandPreprocessEvent event) {
|
public void playerCommand(PlayerCommandPreprocessEvent event) {
|
||||||
String msg = event.getMessage().toLowerCase().replaceAll("/", "").trim();
|
String msg = event.getMessage().replace("/", "").toLowerCase(Locale.ROOT).trim();
|
||||||
if (msg.isEmpty()) {
|
if (msg.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -240,11 +238,9 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
String[] parts = msg.split(" ");
|
String[] parts = msg.split(" ");
|
||||||
Plot plot = plotPlayer.getCurrentPlot();
|
Plot plot = plotPlayer.getCurrentPlot();
|
||||||
// Check WorldEdit
|
// Check WorldEdit
|
||||||
switch (parts[0].toLowerCase()) {
|
switch (parts[0]) {
|
||||||
case "up":
|
case "up":
|
||||||
case "/up":
|
|
||||||
case "worldedit:up":
|
case "worldedit:up":
|
||||||
case "worldedit:/up":
|
|
||||||
if (plot == null || (!plot.isAdded(plotPlayer.getUUID()) && !Permissions
|
if (plot == null || (!plot.isAdded(plotPlayer.getUUID()) && !Permissions
|
||||||
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER, true))) {
|
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER, true))) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -258,63 +254,67 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
List<String> blockedCommands = plot != null ?
|
List<String> blockedCommands = plot != null ?
|
||||||
plot.getFlag(BlockedCmdsFlag.class) :
|
plot.getFlag(BlockedCmdsFlag.class) :
|
||||||
area.getFlag(BlockedCmdsFlag.class);
|
area.getFlag(BlockedCmdsFlag.class);
|
||||||
if (!blockedCommands.isEmpty() && !Permissions
|
if (blockedCommands.isEmpty()) {
|
||||||
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) {
|
return;
|
||||||
String part = parts[0];
|
}
|
||||||
if (parts[0].contains(":")) {
|
if (Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) {
|
||||||
part = parts[0].split(":")[1];
|
return;
|
||||||
msg = msg.replace(parts[0].split(":")[0] + ':', "");
|
}
|
||||||
}
|
// When using namespaced commands, we're not interested in the namespace
|
||||||
String s1 = part;
|
String part = parts[0];
|
||||||
List<String> aliases = new ArrayList<>();
|
if (part.contains(":")) {
|
||||||
for (HelpTopic cmdLabel : Bukkit.getServer().getHelpMap().getHelpTopics()) {
|
String[] namespaced = part.split(":");
|
||||||
if (part.equals(cmdLabel.getName())) {
|
part = namespaced[1];
|
||||||
break;
|
msg = msg.substring(namespaced[0].length() + 1);
|
||||||
}
|
}
|
||||||
String label = cmdLabel.getName().replaceFirst("/", "");
|
msg = replaceAliases(msg, part);
|
||||||
if (aliases.contains(label)) {
|
for (String blocked : blockedCommands) {
|
||||||
continue;
|
if (blocked.equalsIgnoreCase(msg)) {
|
||||||
}
|
String perm;
|
||||||
PluginCommand p;
|
if (plot != null && plot.isAdded(plotPlayer.getUUID())) {
|
||||||
if ((p = Bukkit.getPluginCommand(label)) != null) {
|
perm = "plots.admin.command.blocked-cmds.shared";
|
||||||
for (String a : p.getAliases()) {
|
|
||||||
if (aliases.contains(a)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
aliases.add(a);
|
|
||||||
a = a.replaceFirst("/", "");
|
|
||||||
if (!a.equals(label) && a.equals(part)) {
|
|
||||||
part = label;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!s1.equals(part)) {
|
|
||||||
msg = msg.replace(s1, part);
|
|
||||||
}
|
|
||||||
for (String s : blockedCommands) {
|
|
||||||
Pattern pattern;
|
|
||||||
if (!RegExUtil.compiledPatterns.containsKey(s)) {
|
|
||||||
RegExUtil.compiledPatterns.put(s, pattern = Pattern.compile(s));
|
|
||||||
} else {
|
} else {
|
||||||
pattern = RegExUtil.compiledPatterns.get(s);
|
perm = "plots.admin.command.blocked-cmds.road";
|
||||||
}
|
}
|
||||||
if (pattern.matcher(msg).matches()) {
|
if (!Permissions.hasPermission(plotPlayer, perm)) {
|
||||||
String perm;
|
plotPlayer.sendMessage(TranslatableCaption.of("blockedcmds.command_blocked"));
|
||||||
if (plot != null && plot.isAdded(plotPlayer.getUUID())) {
|
event.setCancelled(true);
|
||||||
perm = "plots.admin.command.blocked-cmds.shared";
|
}
|
||||||
} else {
|
return;
|
||||||
perm = "plots.admin.command.blocked-cmds.road";
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String replaceAliases(String msg, String part) {
|
||||||
|
String s1 = part;
|
||||||
|
Set<String> aliases = new HashSet<>();
|
||||||
|
for (HelpTopic cmdLabel : Bukkit.getServer().getHelpMap().getHelpTopics()) {
|
||||||
|
if (part.equals(cmdLabel.getName())) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
String label = cmdLabel.getName().replaceFirst("/", "");
|
||||||
|
if (aliases.contains(label)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
PluginCommand p = Bukkit.getPluginCommand(label);
|
||||||
|
if (p != null) {
|
||||||
|
for (String a : p.getAliases()) {
|
||||||
|
if (aliases.contains(a)) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, perm)) {
|
aliases.add(a);
|
||||||
plotPlayer.sendMessage(TranslatableCaption.of("blockedcmds.command_blocked"));
|
a = a.replaceFirst("/", "");
|
||||||
event.setCancelled(true);
|
if (!a.equals(label) && a.equals(part)) {
|
||||||
|
part = label;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!s1.equals(part)) {
|
||||||
|
msg = msg.replace(s1, part);
|
||||||
|
}
|
||||||
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
@ -46,7 +46,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
|||||||
public class SingleWorldListener implements Listener {
|
public class SingleWorldListener implements Listener {
|
||||||
|
|
||||||
private final Method methodGetHandleChunk;
|
private final Method methodGetHandleChunk;
|
||||||
private Field shouldSave;
|
private Field shouldSave = null;
|
||||||
|
|
||||||
public SingleWorldListener() throws Exception {
|
public SingleWorldListener() throws Exception {
|
||||||
ReflectionUtils.RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
ReflectionUtils.RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||||
@ -59,9 +59,12 @@ public class SingleWorldListener implements Listener {
|
|||||||
} else {
|
} else {
|
||||||
this.shouldSave = classChunk.getField("s").getRealField();
|
this.shouldSave = classChunk.getField("s").getRealField();
|
||||||
}
|
}
|
||||||
} else {
|
} else if (PlotSquared.platform().serverVersion()[1] == 17) {
|
||||||
ReflectionUtils.RefClass classChunk = getRefClass("net.minecraft.world.level.chunk.Chunk");
|
ReflectionUtils.RefClass classChunk = getRefClass("net.minecraft.world.level.chunk.Chunk");
|
||||||
this.shouldSave = classChunk.getField("r").getRealField();
|
this.shouldSave = classChunk.getField("r").getRealField();
|
||||||
|
} else if (PlotSquared.platform().serverVersion()[1] == 18) {
|
||||||
|
ReflectionUtils.RefClass classChunk = getRefClass("net.minecraft.world.level.chunk.IChunkAccess");
|
||||||
|
this.shouldSave = classChunk.getField("b").getRealField();
|
||||||
}
|
}
|
||||||
} catch (NoSuchFieldException e) {
|
} catch (NoSuchFieldException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -347,13 +347,15 @@ public class BukkitUtil extends WorldUtil {
|
|||||||
final Block block = world.getBlockAt(location.getX(), location.getY(), location.getZ());
|
final Block block = world.getBlockAt(location.getX(), location.getY(), location.getZ());
|
||||||
final Material type = block.getType();
|
final Material type = block.getType();
|
||||||
if (type != Material.LEGACY_SIGN && type != Material.LEGACY_WALL_SIGN) {
|
if (type != Material.LEGACY_SIGN && type != Material.LEGACY_WALL_SIGN) {
|
||||||
BlockFace facing = BlockFace.EAST;
|
BlockFace facing = BlockFace.NORTH;
|
||||||
if (world.getBlockAt(location.getX(), location.getY(), location.getZ() + 1).getType().isSolid()) {
|
if (!world.getBlockAt(location.getX(), location.getY(), location.getZ() + 1).getType().isSolid()) {
|
||||||
facing = BlockFace.NORTH;
|
if (world.getBlockAt(location.getX() - 1, location.getY(), location.getZ()).getType().isSolid()) {
|
||||||
} else if (world.getBlockAt(location.getX() + 1, location.getY(), location.getZ()).getType().isSolid()) {
|
facing = BlockFace.EAST;
|
||||||
facing = BlockFace.WEST;
|
} else if (world.getBlockAt(location.getX() + 1, location.getY(), location.getZ()).getType().isSolid()) {
|
||||||
} else if (world.getBlockAt(location.getX(), location.getY(), location.getZ() - 1).getType().isSolid()) {
|
facing = BlockFace.WEST;
|
||||||
facing = BlockFace.SOUTH;
|
} else if (world.getBlockAt(location.getX(), location.getY(), location.getZ() - 1).getType().isSolid()) {
|
||||||
|
facing = BlockFace.SOUTH;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (PlotSquared.platform().serverVersion()[1] == 13) {
|
if (PlotSquared.platform().serverVersion()[1] == 13) {
|
||||||
block.setType(Material.valueOf(area.legacySignMaterial()), false);
|
block.setType(Material.valueOf(area.legacySignMaterial()), false);
|
||||||
|
@ -67,7 +67,7 @@ public class FaweSchematicHandler extends SchematicHandler {
|
|||||||
final PlotPlayer<?> actor,
|
final PlotPlayer<?> actor,
|
||||||
final RunnableVal<Boolean> whenDone
|
final RunnableVal<Boolean> whenDone
|
||||||
) {
|
) {
|
||||||
delegate.paste(schematic, plot, xOffset, yOffset, zOffset, autoHeight, whenDone);
|
delegate.paste(schematic, plot, xOffset, yOffset, zOffset, autoHeight, actor, whenDone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,6 +35,7 @@ import com.plotsquared.core.plot.world.PlotAreaManager;
|
|||||||
import com.plotsquared.core.util.Permissions;
|
import com.plotsquared.core.util.Permissions;
|
||||||
import com.plotsquared.core.util.WEManager;
|
import com.plotsquared.core.util.WEManager;
|
||||||
import com.plotsquared.core.util.WorldUtil;
|
import com.plotsquared.core.util.WorldUtil;
|
||||||
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.event.extent.EditSessionEvent;
|
import com.sk89q.worldedit.event.extent.EditSessionEvent;
|
||||||
@ -67,6 +68,9 @@ public class WESubscriber {
|
|||||||
WorldEdit.getInstance().getEventBus().unregister(this);
|
WorldEdit.getInstance().getEventBus().unregister(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (event.getStage() != EditSession.Stage.BEFORE_HISTORY) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
World worldObj = event.getWorld();
|
World worldObj = event.getWorld();
|
||||||
if (worldObj == null) {
|
if (worldObj == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -29,6 +29,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
@Deprecated(since = "TODO", forRemoval = true)
|
||||||
public class RegExUtil {
|
public class RegExUtil {
|
||||||
|
|
||||||
public static Map<String, Pattern> compiledPatterns;
|
public static Map<String, Pattern> compiledPatterns;
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.plotsquared.core.util;
|
package com.plotsquared.core.util;
|
||||||
|
|
||||||
import com.fastasyncworldedit.core.regions.RegionWrapper;
|
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
import com.plotsquared.core.configuration.Settings;
|
import com.plotsquared.core.configuration.Settings;
|
||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
@ -45,6 +44,9 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public class WEManager {
|
public class WEManager {
|
||||||
|
|
||||||
|
private static final BlockVector3 MIN = BlockVector3.at(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);
|
||||||
|
private static final BlockVector3 MAX = BlockVector3.at(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||||
|
|
||||||
public static boolean maskContains(Set<CuboidRegion> mask, int x, int y, int z) {
|
public static boolean maskContains(Set<CuboidRegion> mask, int x, int y, int z) {
|
||||||
for (CuboidRegion region : mask) {
|
for (CuboidRegion region : mask) {
|
||||||
if (RegionUtil.contains(region, x, y, z)) {
|
if (RegionUtil.contains(region, x, y, z)) {
|
||||||
@ -92,7 +94,7 @@ public class WEManager {
|
|||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
String world = location.getWorldName();
|
String world = location.getWorldName();
|
||||||
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(world)) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(world)) {
|
||||||
regions.add(RegionWrapper.GLOBAL());
|
regions.add(new CuboidRegion(MIN, MAX));
|
||||||
return regions;
|
return regions;
|
||||||
}
|
}
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
|
@ -18,7 +18,7 @@ plugins {
|
|||||||
idea
|
idea
|
||||||
}
|
}
|
||||||
|
|
||||||
version = "6.6.0"
|
version = "6.6.2-SNAPSHOT"
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = "com.plotsquared"
|
group = "com.plotsquared"
|
||||||
|
@ -6,7 +6,7 @@ guava = "31.0.1-jre" # Version set by Minecraft
|
|||||||
|
|
||||||
# Platform expectations
|
# Platform expectations
|
||||||
paper = "1.18.1-R0.1-SNAPSHOT"
|
paper = "1.18.1-R0.1-SNAPSHOT"
|
||||||
checker-qual = "3.21.2"
|
checker-qual = "3.21.3"
|
||||||
guice = "5.1.0"
|
guice = "5.1.0"
|
||||||
findbugs = "3.0.1"
|
findbugs = "3.0.1"
|
||||||
snakeyaml = "1.30" # Version set by Bukkit
|
snakeyaml = "1.30" # Version set by Bukkit
|
||||||
@ -18,11 +18,11 @@ adventure-platform-bukkit = "4.0.1"
|
|||||||
|
|
||||||
# Plugins
|
# Plugins
|
||||||
worldedit = "7.2.9"
|
worldedit = "7.2.9"
|
||||||
fawe = "2.0.1"
|
fawe = "2.1.0"
|
||||||
vault = "1.7.1"
|
vault = "1.7.1"
|
||||||
placeholderapi = "2.11.1"
|
placeholderapi = "2.11.1"
|
||||||
luckperms = "5.4"
|
luckperms = "5.4"
|
||||||
essentialsx = "2.19.2"
|
essentialsx = "2.19.4"
|
||||||
mvdwapi = "3.1.1"
|
mvdwapi = "3.1.1"
|
||||||
|
|
||||||
# Third party
|
# Third party
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -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-7.4-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
"com.google.guava:guava",
|
"com.google.guava:guava",
|
||||||
"com.google.code.gson:gson",
|
"com.google.code.gson:gson",
|
||||||
"gson",
|
"gson",
|
||||||
"snakeyaml"
|
"snakeyaml",
|
||||||
|
"net.kyori"
|
||||||
],
|
],
|
||||||
"timezone": "Europe/Berlin",
|
"timezone": "Europe/Berlin",
|
||||||
"schedule": [
|
"schedule": [
|
||||||
|
Reference in New Issue
Block a user