mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2024-12-22 16:05:02 +00:00
Merge https://github.com/IntellectualSites/PlotSquared into 1.16
This commit is contained in:
commit
8a7ce084e6
18 changed files with 186 additions and 21 deletions
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
@IntellectualSites/plotsquared-team
|
32
.github/dependabot.yml
vendored
Normal file
32
.github/dependabot.yml
vendored
Normal file
|
@ -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"
|
|
@ -21,7 +21,7 @@
|
|||
<dependency>
|
||||
<groupId>com.plotsquared</groupId>
|
||||
<artifactId>PlotSquared-Core</artifactId>
|
||||
<version>5.13.2</version>
|
||||
<version>5.13.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1030,6 +1031,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) {
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* _____ _ _ _____ _
|
||||
* | __ \| | | | / ____| | |
|
||||
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
|
||||
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
|
||||
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
|
||||
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
|
||||
* | |
|
||||
* |_|
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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<Player> {
|
|||
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) {
|
||||
|
|
|
@ -9,7 +9,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
|
||||
|
@ -19,8 +19,8 @@ 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:annotations:20.0.0")
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.4.0")
|
||||
implementation("org.jetbrains:annotations:20.1.0")
|
||||
implementation("org.khelekore:prtree:1.7.0-SNAPSHOT")
|
||||
implementation("org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT")
|
||||
implementation("me.totalfreedom:TotalFreedomMod:2020.9")
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
<version>19.0.0</version>
|
||||
<version>20.1.0</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -89,7 +89,7 @@
|
|||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
<version>1.25</version>
|
||||
<version>1.26</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -101,7 +101,7 @@
|
|||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib</artifactId>
|
||||
<version>1.3.72</version>
|
||||
<version>1.4.0</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -53,7 +53,7 @@ public class Music extends SubCommand {
|
|||
private static final Collection<String> 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();
|
||||
|
|
|
@ -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<String> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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()));
|
||||
|
|
|
@ -174,4 +174,8 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override public boolean canSee(final PlotPlayer<?> other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -727,6 +727,16 @@ public abstract class PlotPlayer<P> 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);
|
||||
}
|
||||
|
|
|
@ -46,6 +46,8 @@ public class BlockTypeWrapper {
|
|||
|
||||
private static final Map<BlockType, BlockTypeWrapper> blockTypes = new HashMap<>();
|
||||
private static final Map<String, BlockTypeWrapper> 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() {
|
||||
|
|
10
build.gradle
10
build.gradle
|
@ -18,14 +18,14 @@ 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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "maven-publish"
|
||||
id "org.ajoberstar.grgit" version "4.0.1"
|
||||
id "org.ajoberstar.grgit" version "4.0.2"
|
||||
}
|
||||
|
||||
group = "com.plotsquared"
|
||||
|
@ -34,7 +34,7 @@ ext {
|
|||
git = Grgit.open(dir: new File(rootDir.toString() + "/.git"))
|
||||
}
|
||||
|
||||
def ver = "5.13.3"
|
||||
def ver = "5.13.5"
|
||||
def versuffix = ""
|
||||
ext {
|
||||
if (project.hasProperty("versionsuffix")) {
|
||||
|
@ -84,7 +84,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")
|
||||
|
@ -98,7 +98,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")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue