Merge branch 'v6' into features/v6/queue-features

# Conflicts:
#	Core/src/main/java/com/plotsquared/core/generator/SquarePlotManager.java
#	Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotManager.java
#	Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java
This commit is contained in:
dordsor21
2020-10-09 15:23:09 +01:00
43 changed files with 613 additions and 994 deletions

View File

@ -59,7 +59,6 @@ import com.plotsquared.bukkit.util.UpdateUtility;
import com.plotsquared.bukkit.util.task.BukkitTaskManager;
import com.plotsquared.bukkit.util.task.PaperTimeConverter;
import com.plotsquared.bukkit.util.task.SpigotTimeConverter;
import com.plotsquared.bukkit.uuid.BungeePermsUUIDService;
import com.plotsquared.bukkit.uuid.EssentialsUUIDService;
import com.plotsquared.bukkit.uuid.LuckPermsUUIDService;
import com.plotsquared.bukkit.uuid.OfflinePlayerUUIDService;
@ -141,7 +140,6 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.File;
import java.lang.reflect.Method;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@ -237,9 +235,9 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
final PlotSquared plotSquared = new PlotSquared(this, "Bukkit");
if (PlotSquared.platform().getServerVersion()[1] < 13) {
System.out.println("You can't use this version of PlotSquared on a server less than Minecraft 1.13.2.");
System.out.println("Please check the download page for the link to the legacy versions.");
System.out.println("The server will now be shutdown to prevent any corruption.");
logger.error("You can't use this version of PlotSquared on a server less than Minecraft 1.13.2.");
logger.error("Please check the download page for the link to the legacy versions.");
logger.error("The server will now be shutdown to prevent any corruption.");
Bukkit.shutdown();
return;
}
@ -423,14 +421,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
luckPermsUUIDService = null;
}
final BungeePermsUUIDService bungeePermsUUIDService;
if (Settings.UUID.SERVICE_BUNGEE_PERMS && Bukkit.getPluginManager().getPlugin("BungeePerms") != null) {
bungeePermsUUIDService = new BungeePermsUUIDService();
logger.info("(UUID) Using BungeePerms as a complementary UUID service");
} else {
bungeePermsUUIDService = null;
}
final EssentialsUUIDService essentialsUUIDService;
if (Settings.UUID.SERVICE_ESSENTIALSX && Bukkit.getPluginManager().getPlugin("Essentials") != null) {
essentialsUUIDService = new EssentialsUUIDService();
@ -463,10 +453,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
this.impromptuPipeline.registerService(luckPermsUUIDService);
this.backgroundPipeline.registerService(luckPermsUUIDService);
}
if (bungeePermsUUIDService != null) {
this.impromptuPipeline.registerService(bungeePermsUUIDService);
this.backgroundPipeline.registerService(bungeePermsUUIDService);
}
if (essentialsUUIDService != null) {
this.impromptuPipeline.registerService(essentialsUUIDService);
this.backgroundPipeline.registerService(essentialsUUIDService);
@ -500,8 +486,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
ChatFormatter.formatters.add(getInjector().getInstance(PlaceholderFormatter.class));
}
logger.info("PlotSquared hooked into PlaceholderAPI");
} else {
logger.info("PlaceholderAPI is not in use. Hook deactivated");
}
this.startMetrics();
@ -700,7 +684,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
}
@SuppressWarnings("deprecation") private void runEntityTask() {
logger.info("KillAllEntities started");
TaskManager.runTaskRepeat(() -> this.plotAreaManager.forEachPlotArea(plotArea -> {
final World world = Bukkit.getWorld(plotArea.getWorldName());
try {
@ -1047,13 +1030,21 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
return new BukkitPlotGenerator(world, generator, this.plotAreaManager);
}
@Override public List<Map.Entry<Map.Entry<String, String>, Boolean>> getPluginIds() {
List<Map.Entry<Map.Entry<String, String>, Boolean>> names = new ArrayList<>();
for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
Map.Entry<String, String> id = new AbstractMap.SimpleEntry<>(plugin.getName(), plugin.getDescription().getVersion());
names.add(new AbstractMap.SimpleEntry<>(id, plugin.isEnabled()));
@Override public String getPluginList() {
StringBuilder msg = new StringBuilder();
Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins();
msg.append("Plugins (").append(plugins.length).append("): \n");
for (Plugin p : plugins) {
msg.append(" - ").append(p.getName()).append(":").append("\n")
.append(" • Version: ").append(p.getDescription().getVersion()).append("\n")
.append(" • Enabled: ").append(p.isEnabled()).append("\n")
.append(" • Main: ").append(p.getDescription().getMain()).append("\n")
.append(" • Authors: ").append(p.getDescription().getAuthors()).append("\n")
.append(" • Load Before: ").append(p.getDescription().getLoadBefore()).append("\n")
.append(" • Dependencies: ").append(p.getDescription().getDepend()).append("\n")
.append(" • Soft Dependencies: ").append(p.getDescription().getSoftDepend()).append("\n");
}
return names;
return msg.toString();
}
@Override @Nonnull public com.plotsquared.core.location.World<?> getPlatformWorld(@Nonnull final String worldName) {
@ -1061,7 +1052,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
}
@Override @Nonnull public Audience getConsoleAudience() {
return BukkitUtil.BUKKIT_AUDIENCES.audience(Bukkit.getConsoleSender());
return BukkitUtil.BUKKIT_AUDIENCES.console();
}
@Override public String getPluginName() {

View File

@ -229,18 +229,24 @@ public class PaperListener implements Listener {
}
Plot plot = location.getOwnedPlotAbs();
if (plot == null) {
EntityType type = event.getType();
if (!area.isMobSpawning()) {
EntityType type = event.getType();
switch (type) {
case DROPPED_ITEM:
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
event.setShouldAbortSpawn(true);
event.setCancelled(true);
break;
return;
}
case PLAYER:
return;
}
if (type.isAlive()) {
event.setShouldAbortSpawn(true);
event.setCancelled(true);
}
}
if (!area.isMiscSpawnUnowned() && !type.isAlive()) {
event.setShouldAbortSpawn(true);
event.setCancelled(true);
}

View File

@ -90,6 +90,7 @@ import org.bukkit.FluidCollisionMode;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
@ -1118,9 +1119,16 @@ public class PlayerEventListener extends PlotListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
BlockFace bf = event.getBlockFace();
Block block =
event.getBlockClicked().getLocation().add(bf.getModX(), bf.getModY(), bf.getModZ())
.getBlock();
final Block block;
// if the block can be waterlogged, the event might waterlog the block
// sometimes
if (event.getBlockClicked().getBlockData() instanceof Waterlogged) {
block = event.getBlockClicked();
} else {
block = event.getBlockClicked().getLocation()
.add(bf.getModX(), bf.getModY(), bf.getModZ())
.getBlock();
}
Location location = BukkitUtil.adapt(block.getLocation());
PlotArea area = location.getPlotArea();
if (area == null) {

View File

@ -1,84 +0,0 @@
/*
* _____ _ _ _____ _
* | __ \| | | | / ____| | |
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
* | |
* |_|
* 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 <https://www.gnu.org/licenses/>.
*/
package com.plotsquared.bukkit.uuid;
import com.plotsquared.core.uuid.UUIDMapping;
import com.plotsquared.core.uuid.UUIDService;
import net.alpenblock.bungeeperms.BungeePerms;
import net.alpenblock.bungeeperms.io.UUIDPlayerDB;
import org.bukkit.Bukkit;
import org.bukkit.plugin.RegisteredServiceProvider;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* UUID service that uses the BungeePerms API
*/
public class BungeePermsUUIDService implements UUIDService {
private final BungeePerms bp;
public BungeePermsUUIDService() {
final RegisteredServiceProvider<BungeePerms> provider = Bukkit.getServicesManager().getRegistration(BungeePerms.class);
if (provider != null) {
this.bp = provider.getProvider();
} else {
throw new IllegalStateException("BungeePerms is not available");
}
}
@Override @Nonnull public List<UUIDMapping> getNames(@Nonnull final List<UUID> uuids) {
final List<UUIDMapping> mappings = new ArrayList<>(uuids.size());
final UUIDPlayerDB uuiddb = BungeePerms.getInstance().getPermissionsManager().getUUIDPlayerDB();
for (final UUID uuid : uuids) {
try {
final String username = uuiddb.getPlayerName(uuid);
if (username != null) {
mappings.add(new UUIDMapping(uuid, username));
}
} catch (final Exception ignored) {}
}
return mappings;
}
@Override @Nonnull public List<UUIDMapping> getUUIDs(@Nonnull final List<String> usernames) {
final List<UUIDMapping> mappings = new ArrayList<>(usernames.size());
final UUIDPlayerDB uuiddb = BungeePerms.getInstance().getPermissionsManager().getUUIDPlayerDB();
for (final String username : usernames) {
try {
final UUID uuid = uuiddb.getUUID(username);
if (username != null) {
mappings.add(new UUIDMapping(uuid, username));
}
} catch (final Exception ignored) {}
}
return mappings;
}
}

View File

@ -1,4 +1,4 @@
name: ${name}
name: PlotSquared
main: com.plotsquared.bukkit.BukkitPlatform
api-version: "1.13"
version: "${version}"
@ -214,6 +214,8 @@ permissions:
default: false
plots.admin.caps.other:
default: false
plots.admin.music.other:
default: false
plots.admin.destroy.unowned:
default: false
plots.admin.destroy.groundlevel: