From acb0bd95f2439a79e93998ee385fdecf09b913dc Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 22 Aug 2020 23:05:56 +0000 Subject: [PATCH 01/17] Bump kotlin-stdlib from 1.3.72 to 1.4.0 Bumps [kotlin-stdlib](https://github.com/JetBrains/kotlin) from 1.3.72 to 1.4.0. - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/v1.4.0/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/compare/v1.3.72...v1.4.0) Signed-off-by: dependabot-preview[bot] --- Core/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/build.gradle b/Core/build.gradle index 4d7b74e18..9416a519e 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -15,7 +15,7 @@ dependencies { testCompileOnly("org.projectlombok:lombok:1.18.8") annotationProcessor("org.projectlombok:lombok:1.18.8") testAnnotationProcessor("org.projectlombok:lombok:1.18.8") - implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.72") + implementation("org.jetbrains.kotlin:kotlin-stdlib:1.4.0") implementation("org.jetbrains:annotations:20.0.0") implementation("org.khelekore:prtree:1.7.0-SNAPSHOT") } From 97e34844b441926da91e2551e7c0865e1ad38345 Mon Sep 17 00:00:00 2001 From: N0tMyFaultOG Date: Wed, 2 Sep 2020 12:13:23 +0200 Subject: [PATCH 02/17] Add option to opt-out MvDW Placeholder API --- Bukkit/pom.xml | 2 +- .../plotsquared/bukkit/listener/ServerListener.java | 3 ++- Core/pom.xml | 12 ++++++------ .../com/plotsquared/core/configuration/Settings.java | 4 +++- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Bukkit/pom.xml b/Bukkit/pom.xml index 4119b792b..ef3ad830a 100644 --- a/Bukkit/pom.xml +++ b/Bukkit/pom.xml @@ -21,7 +21,7 @@ com.plotsquared PlotSquared-Core - 5.13.2 + 5.13.3 compile diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ServerListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ServerListener.java index c74db87d4..60842c2d9 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ServerListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ServerListener.java @@ -29,6 +29,7 @@ import com.plotsquared.bukkit.BukkitMain; import com.plotsquared.bukkit.placeholder.MVdWPlaceholders; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.Settings; import org.bukkit.Bukkit; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -43,7 +44,7 @@ public class ServerListener implements Listener { } @EventHandler public void onServerLoad(ServerLoadEvent event) { - if (Bukkit.getPluginManager().getPlugin("MVdWPlaceholderAPI") != null) { + if (Bukkit.getPluginManager().getPlugin("MVdWPlaceholderAPI") != null && Settings.Enabled_Components.USE_MVDWAPI) { new MVdWPlaceholders(this.plugin, PlotSquared.get().getPlaceholderRegistry()); PlotSquared.log(Captions.PREFIX + "&6PlotSquared hooked into MVdWPlaceholderAPI"); } diff --git a/Core/pom.xml b/Core/pom.xml index d69f10a99..ad175038f 100644 --- a/Core/pom.xml +++ b/Core/pom.xml @@ -18,12 +18,6 @@ 1.18.12 runtime - - org.jetbrains - annotations - 19.0.0 - runtime - com.sk89q.worldedit worldedit-core @@ -92,6 +86,12 @@ 1.3.72 runtime + + org.jetbrains + annotations + 20.0.0 + runtime + org.khelekore prtree diff --git a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java index e2fdfde60..81ac560bf 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java @@ -582,7 +582,7 @@ public class Settings extends Config { @Comment("Actively purge invalid database entries") public static boolean DATABASE_PURGER = false; @Comment({"Delete plots when a player is banned.", - "Note: This only works with the /minecraft:ban command. Any punishment plugin like LiteBans is not supported."}) public static boolean BAN_DELETER = false; + "Note: This only works with the /minecraft:ban command. Any punishment plugin is not supported."}) public static boolean BAN_DELETER = false; @Comment("Allows PlaceholderAPI placeholders to be used in captions, flags, etc.") public static boolean EXTERNAL_PLACEHOLDERS = true; @Comment("Make road regeneration persistent across restarts") public static boolean @@ -593,6 +593,8 @@ public class Settings extends Config { public static boolean EXTENDED_USERNAME_COMPLETION = true; @Comment("Command aliases that will be tab completed") public static List TAB_COMPLETED_ALIASES = Arrays.asList("plot", "plots", "p", "plotsquared", "plot2", "p2", "ps", "2", "plotme", "plotz", "ap"); + @Comment("Whether PlotSquared should hook into MvDWPlaceholderAPI or not") + public static boolean USE_MVDWAPI = true; } } From 49984f2560b64fbb9b49eb4f4a3d8e13e33097f5 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2020 13:55:15 +0000 Subject: [PATCH 03/17] Create Dependabot config file --- .github/dependabot.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..3fe9883e9 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,32 @@ +version: 2 +updates: +- package-ecosystem: gradle + directory: "/" + schedule: + interval: weekly + open-pull-requests-limit: 10 + target-branch: v5 + ignore: + - dependency-name: com.google.guava:guava + versions: + - ">= 22.a" + - "< 23" + - dependency-name: com.google.guava:guava + versions: + - ">= 23.a" + - "< 24" + - dependency-name: com.squareup.okhttp3:okhttp + versions: + - "> 4.2.2" + - dependency-name: com.squareup.okio:okio + versions: + - "> 2.4.1" + - "< 3" + - dependency-name: com.squareup.retrofit2:retrofit + versions: + - "> 2.4.0" + - "< 3" + - dependency-name: net.kyori:text-adapter-bukkit + versions: + - "> 3.0.3" + - "< 3.1" From 20b4cec0ca5f6a7a847d8b86f2bd38fb569c0974 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2020 14:10:39 +0000 Subject: [PATCH 04/17] Bump org.ajoberstar.grgit from 4.0.1 to 4.0.2 Bumps org.ajoberstar.grgit from 4.0.1 to 4.0.2. Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 4a6f9293a..056b8d5aa 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ buildscript { plugins { id "maven-publish" - id "org.ajoberstar.grgit" version "4.0.1" + id "org.ajoberstar.grgit" version "4.0.2" } group = "com.plotsquared" From 32a8dcd411694efaf2b0a0dc49c97467598b6ac5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2020 14:10:44 +0000 Subject: [PATCH 05/17] Bump annotations from 20.0.0 to 20.1.0 Bumps [annotations](https://github.com/JetBrains/java-annotations) from 20.0.0 to 20.1.0. - [Release notes](https://github.com/JetBrains/java-annotations/releases) - [Changelog](https://github.com/JetBrains/java-annotations/blob/master/CHANGELOG.md) - [Commits](https://github.com/JetBrains/java-annotations/compare/20.0.0...20.1.0) Signed-off-by: dependabot[bot] --- Core/build.gradle | 2 +- build.gradle | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/build.gradle b/Core/build.gradle index 9416a519e..0396477b7 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -16,7 +16,7 @@ dependencies { annotationProcessor("org.projectlombok:lombok:1.18.8") testAnnotationProcessor("org.projectlombok:lombok:1.18.8") implementation("org.jetbrains.kotlin:kotlin-stdlib:1.4.0") - implementation("org.jetbrains:annotations:20.0.0") + implementation("org.jetbrains:annotations:20.1.0") implementation("org.khelekore:prtree:1.7.0-SNAPSHOT") } diff --git a/build.gradle b/build.gradle index 4a6f9293a..d47bedb06 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ buildscript { configurations.all { resolutionStrategy { force("org.ow2.asm:asm:8.0.1") - force("org.jetbrains:annotations:20.0.0") + force("org.jetbrains:annotations:20.1.0") } } } @@ -94,7 +94,7 @@ subprojects { implementation("com.google.guava:guava:21.0") { because("Minecraft uses Guava 21 as of 1.13") } - compileOnly("org.jetbrains:annotations:19.0.0") + compileOnly("org.jetbrains:annotations:20.1.0") compileClasspath("org.projectlombok:lombok:1.18.12") testCompileOnly("org.projectlombok:lombok:1.18.12") annotationProcessor("org.projectlombok:lombok:1.18.8") @@ -106,7 +106,7 @@ subprojects { resolutionStrategy { force("junit:junit:4.12") force("com.google.guava:guava:21.0") - force("org.jetbrains:annotations:20.0.0") + force("org.jetbrains:annotations:20.1.0") force("com.google.code.findbugs:jsr305:3.0.2") } } From 7c53bfc870dc21fc71eb15fbc5bd55483516c544 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2020 14:10:44 +0000 Subject: [PATCH 06/17] Bump snakeyaml from 1.25 to 1.26 Bumps [snakeyaml](https://bitbucket.org/asomov/snakeyaml) from 1.25 to 1.26. - [Commits](https://bitbucket.org/asomov/snakeyaml/branches/compare/snakeyaml-1.26..snakeyaml-1.25) Signed-off-by: dependabot[bot] --- Core/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/build.gradle b/Core/build.gradle index 9416a519e..8ac5d41f7 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -5,7 +5,7 @@ repositories { def textVersion = "3.0.2" dependencies { - implementation("org.yaml:snakeyaml:1.25") + implementation("org.yaml:snakeyaml:1.26") implementation("com.google.code.gson:gson:2.8.6") { because("Minecraft uses GSON 2.8.0") force = true From 7a529e156d67de3ac2cbbfa5f374f7929a0dab0b Mon Sep 17 00:00:00 2001 From: N0tMyFaultOG Date: Wed, 2 Sep 2020 17:03:56 +0200 Subject: [PATCH 07/17] Add deb for onBlockIgnite event --- .../bukkit/listener/BlockEventListener.java | 1 + Core/pom.xml | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java index fcd5d6951..2c068e2e1 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java @@ -1030,6 +1030,7 @@ public class BlockEventListener implements Listener { } } else if (!plot.getFlag(BlockIgnitionFlag.class)) { event.setCancelled(true); + plot.debug("Block ignition was cancelled because block-ignition = false"); } } else { if (plot == null) { diff --git a/Core/pom.xml b/Core/pom.xml index ad175038f..3d4ebf3a7 100644 --- a/Core/pom.xml +++ b/Core/pom.xml @@ -18,6 +18,12 @@ 1.18.12 runtime + + org.jetbrains + annotations + 20.1.0 + runtime + com.sk89q.worldedit worldedit-core @@ -71,7 +77,7 @@ org.yaml snakeyaml - 1.25 + 1.26 runtime @@ -83,13 +89,7 @@ org.jetbrains.kotlin kotlin-stdlib - 1.3.72 - runtime - - - org.jetbrains - annotations - 20.0.0 + 1.4.0 runtime From d19dde2f85c1ce24de5d7438c17d3dd94a34698b Mon Sep 17 00:00:00 2001 From: N0tMyFaultOG Date: Wed, 2 Sep 2020 17:18:41 +0200 Subject: [PATCH 08/17] Add more debugs --- .../java/com/plotsquared/bukkit/listener/BlockEventListener.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java index 2c068e2e1..bd0d61405 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java @@ -530,6 +530,7 @@ public class BlockEventListener implements Listener { } if (!plot.getFlag(IceFormFlag.class)) { event.setCancelled(true); + plot.debug("Ice could not form because ice-form = false"); } } From babad3ab6de755de20a9e11376837442b5879a16 Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Fri, 4 Sep 2020 14:49:02 +0200 Subject: [PATCH 09/17] Don't validate plot aliases with offline players (Fixes PS-126) --- Core/src/main/java/com/plotsquared/core/command/Alias.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Core/src/main/java/com/plotsquared/core/command/Alias.java b/Core/src/main/java/com/plotsquared/core/command/Alias.java index 59c0da49c..71a82c91f 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Alias.java +++ b/Core/src/main/java/com/plotsquared/core/command/Alias.java @@ -27,6 +27,7 @@ package com.plotsquared.core.command; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.location.Location; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; @@ -151,6 +152,12 @@ public class Alias extends SubCommand { MainUtil.sendMessage(player, Captions.ALIAS_IS_TAKEN); return; } + if (Settings.UUID.OFFLINE) { + plot.setAlias(alias); + MainUtil.sendMessage(player, + Captions.ALIAS_SET_TO.getTranslated().replaceAll("%alias%", alias)); + return; + } PlotSquared.get().getImpromptuUUIDPipeline().getSingle(alias, ((uuid, throwable) -> { if (throwable instanceof TimeoutException) { MainUtil.sendMessage(player, Captions.FETCHING_PLAYERS_TIMEOUT); From 37010d92ee9869a43978a2e06515f5f3668a4571 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 5 Sep 2020 13:42:11 +0200 Subject: [PATCH 10/17] Create CODEOWNERS --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..f0809ab2a --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +@IntellectualSites/plotsquared-team From f6d1e2b3b8d7bf1145a035a21692a16a14673f88 Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Sat, 5 Sep 2020 13:24:18 +0200 Subject: [PATCH 11/17] Check TileState manually on 1.13.2, fixes PS-122 --- .../com/plotsquared/bukkit/BukkitMain.java | 8 ++- .../bukkit/listener/PaperListener113.java | 58 +++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener113.java diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java index 34cbcc5b3..4f149d126 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java @@ -25,6 +25,7 @@ */ package com.plotsquared.bukkit; +import com.plotsquared.bukkit.chat.Reflection; import com.plotsquared.bukkit.generator.BukkitHybridUtils; import com.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.plotsquared.bukkit.listener.BlockEventListener; @@ -32,6 +33,7 @@ import com.plotsquared.bukkit.listener.ChunkListener; import com.plotsquared.bukkit.listener.EntityEventListener; import com.plotsquared.bukkit.listener.EntitySpawnListener; import com.plotsquared.bukkit.listener.PaperListener; +import com.plotsquared.bukkit.listener.PaperListener113; import com.plotsquared.bukkit.listener.PlayerEventListener; import com.plotsquared.bukkit.listener.ProjectileEventListener; import com.plotsquared.bukkit.listener.ServerListener; @@ -904,7 +906,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< getServer().getPluginManager().registerEvents(new ProjectileEventListener(), this); getServer().getPluginManager().registerEvents(new EntitySpawnListener(), this); if (PaperLib.isPaper() && Settings.Paper_Components.PAPER_LISTENERS) { - getServer().getPluginManager().registerEvents(new PaperListener(), this); + if (Reflection.getVersion().startsWith("v1_13")) { + getServer().getPluginManager().registerEvents(new PaperListener113(), this); + } else { + getServer().getPluginManager().registerEvents(new PaperListener(), this); + } } PlotListener.startRunnable(); } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener113.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener113.java new file mode 100644 index 000000000..d098182bf --- /dev/null +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener113.java @@ -0,0 +1,58 @@ +package com.plotsquared.bukkit.listener; + +import com.plotsquared.bukkit.util.BukkitUtil; +import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.Settings; +import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.PlotArea; +import org.bukkit.block.Banner; +import org.bukkit.block.Beacon; +import org.bukkit.block.Bed; +import org.bukkit.block.BlockState; +import org.bukkit.block.CommandBlock; +import org.bukkit.block.Comparator; +import org.bukkit.block.Conduit; +import org.bukkit.block.Container; +import org.bukkit.block.CreatureSpawner; +import org.bukkit.block.DaylightDetector; +import org.bukkit.block.EnchantingTable; +import org.bukkit.block.EndGateway; +import org.bukkit.block.EnderChest; +import org.bukkit.block.Jukebox; +import org.bukkit.block.Sign; +import org.bukkit.block.Skull; +import org.bukkit.block.Structure; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.BlockPlaceEvent; + +public class PaperListener113 extends PaperListener { + + @EventHandler + public void onBlockPlace(BlockPlaceEvent event) { + if (!Settings.Paper_Components.TILE_ENTITY_CHECK || !Settings.Enabled_Components.CHUNK_PROCESSOR) { + return; + } + BlockState state = event.getBlock().getState(false); + if (!(state instanceof Banner || state instanceof Beacon || state instanceof Bed + || state instanceof CommandBlock || state instanceof Comparator || state instanceof Conduit + || state instanceof Container || state instanceof CreatureSpawner || state instanceof DaylightDetector + || state instanceof EnchantingTable || state instanceof EnderChest || state instanceof EndGateway + || state instanceof Jukebox || state instanceof Sign || state instanceof Skull + || state instanceof Structure)) { + return; + } + final Location location = BukkitUtil.getLocation(event.getBlock().getLocation()); + final PlotArea plotArea = location.getPlotArea(); + if (plotArea == null) { + return; + } + final int tileEntityCount = event.getBlock().getChunk().getTileEntities(false).length; + if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) { + final PlotPlayer plotPlayer = BukkitUtil.getPlayer(event.getPlayer()); + Captions.TILE_ENTITY_CAP_REACHED.send(plotPlayer, Settings.Chunk_Processor.MAX_TILES); + event.setCancelled(true); + event.setBuild(false); + } + } +} From 5c48e4ad19088b940d06d9f540a2f59b566bd574 Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Sat, 5 Sep 2020 13:28:04 +0200 Subject: [PATCH 12/17] Add missing license header --- .../bukkit/listener/PaperListener113.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener113.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener113.java index d098182bf..fc5fca677 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener113.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener113.java @@ -1,3 +1,28 @@ +/* + * _____ _ _ _____ _ + * | __ \| | | | / ____| | | + * | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| | + * | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` | + * | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| | + * |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_| + * | | + * |_| + * PlotSquared plot management system for Minecraft + * Copyright (C) 2020 IntellectualSites + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.plotsquared.bukkit.listener; import com.plotsquared.bukkit.util.BukkitUtil; From 0aeca40137d85d66e6ad0b67a4a42b324cce0b0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Sat, 5 Sep 2020 18:48:58 +0200 Subject: [PATCH 13/17] Take player visibility into account when sending notify-enter and notify-leave messages. Fixes PS-103. --- .../com/plotsquared/bukkit/player/BukkitPlayer.java | 8 ++++++++ .../com/plotsquared/core/listener/PlotListener.java | 8 ++++---- .../com/plotsquared/core/player/ConsolePlayer.java | 4 ++++ .../java/com/plotsquared/core/player/PlotPlayer.java | 10 ++++++++++ 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java index 643039600..1d4a0284e 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java @@ -32,6 +32,7 @@ import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.ConsolePlayer; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.PlotWeather; import com.plotsquared.core.util.EconHandler; @@ -354,6 +355,13 @@ public class BukkitPlayer extends PlotPlayer { return this.player.isBanned(); } + @Override public boolean canSee(final PlotPlayer other) { + if (other instanceof ConsolePlayer) { + return true; + } else { + return this.player.canSee(((BukkitPlayer) other).getPlatformPlayer()); + } + } public PlayerTeleportEvent.TeleportCause getTeleportCause(@NotNull final TeleportCause cause) { switch (cause) { diff --git a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java index 361a71b28..bd99fe197 100644 --- a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java +++ b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java @@ -160,8 +160,8 @@ public class PlotListener { if (plot.getFlag(NotifyEnterFlag.class)) { if (!Permissions.hasPermission(player, "plots.flag.notify-enter.bypass")) { for (UUID uuid : plot.getOwners()) { - final PlotPlayer owner = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid); - if (owner != null && !owner.getUUID().equals(player.getUUID())) { + final PlotPlayer owner = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid); + if (owner != null && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) { MainUtil.sendMessage(owner, Captions.NOTIFY_ENTER.getTranslated() .replace("%player", player.getName()) .replace("%plot", plot.getId().toString())); @@ -336,8 +336,8 @@ public class PlotListener { if (plot.getFlag(NotifyLeaveFlag.class)) { if (!Permissions.hasPermission(player, "plots.flag.notify-enter.bypass")) { for (UUID uuid : plot.getOwners()) { - final PlotPlayer owner = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid); - if ((owner != null) && !owner.getUUID().equals(player.getUUID())) { + final PlotPlayer owner = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid); + if ((owner != null) && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) { MainUtil.sendMessage(owner, Captions.NOTIFY_LEAVE.getTranslated() .replace("%player", player.getName()) .replace("%plot", plot.getId().toString())); diff --git a/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java b/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java index 9a97800e7..10a27c0fd 100644 --- a/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java +++ b/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java @@ -174,4 +174,8 @@ public class ConsolePlayer extends PlotPlayer { return false; } + @Override public boolean canSee(final PlotPlayer other) { + return true; + } + } diff --git a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java index b11a33ba6..95fba9a60 100644 --- a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java +++ b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java @@ -727,6 +727,16 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer } } + /** + * Check if the player is able to see the other player. + * This does not mean that the other player is in line of sight of the player, + * but rather that the player is permitted to see the other player. + * + * @param other Other player + * @return {@code true} if the player is able to see the other player, {@code false} if not + */ + public abstract boolean canSee(PlotPlayer other); + public boolean hasPersistentMeta(String key) { return this.metaMap.containsKey(key); } From f2355a76d68014306315dc31eb0fe731b091cec8 Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Sun, 6 Sep 2020 23:36:36 +0200 Subject: [PATCH 14/17] Add default namespace when wrapping block categories by their ids --- .../core/plot/flag/types/BlockTypeWrapper.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java index 9af840d4c..d29140672 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java @@ -46,6 +46,8 @@ public class BlockTypeWrapper { private static final Map blockTypes = new HashMap<>(); private static final Map blockCategories = new HashMap<>(); + private static final String minecraftNamespace = "minecraft"; + @Nullable @Getter private final BlockType blockType; @Nullable private final String blockCategoryId; @Nullable private BlockCategory blockCategory; @@ -78,7 +80,14 @@ public class BlockTypeWrapper { } public static BlockTypeWrapper get(final String blockCategoryId) { - return blockCategories.computeIfAbsent(blockCategoryId, BlockTypeWrapper::new); + // use minecraft as default namespace + String id; + if (blockCategoryId.indexOf(':') == -1) { + id = minecraftNamespace + ":" + blockCategoryId; + } else { + id = blockCategoryId; + } + return blockCategories.computeIfAbsent(id, BlockTypeWrapper::new); } @Override public String toString() { From 0c6113b0d1a04096ac3d406b4581baab4b8ad22e Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Wed, 9 Sep 2020 23:31:30 +0200 Subject: [PATCH 15/17] 5.13.4 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 615053d2c..5fc85e33f 100644 --- a/build.gradle +++ b/build.gradle @@ -30,7 +30,7 @@ ext { git = Grgit.open(dir: new File(rootDir.toString() + "/.git")) } -def ver = "5.13.3" +def ver = "5.13.4" def versuffix = "" ext { if (project.hasProperty("versionsuffix")) { From 5463f15633b56a8b33ec7f2aae3acc4c54475cba Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Fri, 11 Sep 2020 01:16:57 +0200 Subject: [PATCH 16/17] Add pigstep music disc --- Core/src/main/java/com/plotsquared/core/command/Music.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/main/java/com/plotsquared/core/command/Music.java b/Core/src/main/java/com/plotsquared/core/command/Music.java index 91b756a81..c113f6ae0 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Music.java +++ b/Core/src/main/java/com/plotsquared/core/command/Music.java @@ -53,7 +53,7 @@ public class Music extends SubCommand { private static final Collection DISCS = Arrays .asList("music_disc_13", "music_disc_cat", "music_disc_blocks", "music_disc_chirp", "music_disc_far", "music_disc_mall", "music_disc_mellohi", "music_disc_stal", - "music_disc_strad", "music_disc_ward", "music_disc_11", "music_disc_wait"); + "music_disc_strad", "music_disc_ward", "music_disc_11", "music_disc_wait", "music_disc_pigstep"); @Override public boolean onCommand(PlotPlayer player, String[] args) { Location location = player.getLocation(); From 648953ec1fa3df3c614aff37c228e4b29131934a Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Fri, 11 Sep 2020 12:27:23 +0200 Subject: [PATCH 17/17] 5.13.5 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 5fc85e33f..c55f5f6e8 100644 --- a/build.gradle +++ b/build.gradle @@ -30,7 +30,7 @@ ext { git = Grgit.open(dir: new File(rootDir.toString() + "/.git")) } -def ver = "5.13.4" +def ver = "5.13.5" def versuffix = "" ext { if (project.hasProperty("versionsuffix")) {