mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Merge branch 'v6' into features/v6/services
This commit is contained in:
commit
45e75cc06e
@ -98,13 +98,24 @@ task copyFiles {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def adventureVersion = '4.0.0-SNAPSHOT'
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
dependencies {
|
dependencies {
|
||||||
include(dependency(":PlotSquared-Core"))
|
include(dependency(":PlotSquared-Core"))
|
||||||
include(dependency("io.papermc:paperlib:1.0.4"))
|
include(dependency("io.papermc:paperlib:1.0.4"))
|
||||||
include(dependency("net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT"))
|
include(dependency("net.kyori:adventure-platform-bukkit:${adventureVersion}"))
|
||||||
include(dependency("net.kyori:adventure-text-minimessage:3.0.0-SNAPSHOT"))
|
include(dependency("net.kyori:adventure-text-minimessage:3.0.0-SNAPSHOT"))
|
||||||
|
include(dependency("net.kyori:adventure-text-serializer-bungeecord:${adventureVersion}"))
|
||||||
|
include(dependency("net.kyori:adventure-text-serializer-legacy:${adventureVersion}"))
|
||||||
|
include(dependency("net.kyori:adventure-text-serializer-gson:${adventureVersion}"))
|
||||||
|
include(dependency("net.kyori:adventure-api:${adventureVersion}"))
|
||||||
|
include(dependency("net.kyori:adventure-platform-api:${adventureVersion}"))
|
||||||
|
include(dependency("net.kyori:adventure-platform-common:${adventureVersion}"))
|
||||||
|
include(dependency("net.kyori:adventure-platform-viaversion:${adventureVersion}"))
|
||||||
|
include(dependency("net.kyori:adventure-nbt:${adventureVersion}"))
|
||||||
|
include(dependency("net.kyori:examination-api:1.0.0-SNAPSHOT"))
|
||||||
|
include(dependency("net.kyori:examination-string:1.0.0-SNAPSHOT"))
|
||||||
include(dependency("org.bstats:bstats-bukkit:1.7"))
|
include(dependency("org.bstats:bstats-bukkit:1.7"))
|
||||||
include(dependency("org.khelekore:prtree:1.7.0-SNAPSHOT"))
|
include(dependency("org.khelekore:prtree:1.7.0-SNAPSHOT"))
|
||||||
include(dependency("com.sk89q:squirrelid:1.0.0-SNAPSHOT"))
|
include(dependency("com.sk89q:squirrelid:1.0.0-SNAPSHOT"))
|
||||||
@ -118,7 +129,7 @@ shadowJar {
|
|||||||
include(dependency('com.intellectualsites:Pipeline:1.4.0-SNAPSHOT'))
|
include(dependency('com.intellectualsites:Pipeline:1.4.0-SNAPSHOT'))
|
||||||
}
|
}
|
||||||
|
|
||||||
relocate('net.kyori.text', 'com.plotsquared.formatting.text')
|
relocate('net.kyori.adventure', 'com.plotsquared.core.configuration.adventure')
|
||||||
relocate("io.papermc.lib", "com.plotsquared.bukkit.paperlib")
|
relocate("io.papermc.lib", "com.plotsquared.bukkit.paperlib")
|
||||||
relocate("org.bstats", "com.plotsquared.metrics")
|
relocate("org.bstats", "com.plotsquared.metrics")
|
||||||
relocate('com.sk89q.squirrelid', 'com.plotsquared.squirrelid')
|
relocate('com.sk89q.squirrelid', 'com.plotsquared.squirrelid')
|
||||||
@ -126,6 +137,7 @@ shadowJar {
|
|||||||
relocate('org.apache.logging.slf4j', 'com.plotsquared.logging.apache')
|
relocate('org.apache.logging.slf4j', 'com.plotsquared.logging.apache')
|
||||||
relocate('org.slf4j', 'com.plotsquared.logging.slf4j')
|
relocate('org.slf4j', 'com.plotsquared.logging.slf4j')
|
||||||
relocate('com.google.inject', 'com.plotsquared.google')
|
relocate('com.google.inject', 'com.plotsquared.google')
|
||||||
|
relocate('javax.inject', 'com.plotsquared.core.inject.javax')
|
||||||
|
|
||||||
archiveFileName = "${project.name}-${parent.version}.jar"
|
archiveFileName = "${project.name}-${parent.version}.jar"
|
||||||
destinationDirectory = file "../target"
|
destinationDirectory = file "../target"
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit;
|
package com.plotsquared.bukkit;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit;
|
package com.plotsquared.bukkit;
|
||||||
|
|
||||||
@ -29,6 +29,7 @@ import com.google.inject.Guice;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
import com.google.inject.Key;
|
import com.google.inject.Key;
|
||||||
|
import com.google.inject.Singleton;
|
||||||
import com.google.inject.Stage;
|
import com.google.inject.Stage;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
||||||
@ -161,7 +162,7 @@ import static com.plotsquared.core.util.PremiumVerification.getResourceID;
|
|||||||
import static com.plotsquared.core.util.PremiumVerification.getUserID;
|
import static com.plotsquared.core.util.PremiumVerification.getUserID;
|
||||||
import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused") @Singleton
|
||||||
public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPlatform<Player> {
|
public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPlatform<Player> {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger("P2/" + BukkitPlatform.class.getSimpleName());
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + BukkitPlatform.class.getSimpleName());
|
||||||
@ -256,12 +257,12 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (PremiumVerification.isPremium()) {
|
if (PremiumVerification.isPremium()) {
|
||||||
logger.info("[P2] PlotSquared version licensed to Spigot user {}", getUserID());
|
logger.info("PlotSquared version licensed to Spigot user {}", getUserID());
|
||||||
logger.info("[P2] https://www.spigotmc.org/resources/{}", getResourceID());
|
logger.info("https://www.spigotmc.org/resources/{}", getResourceID());
|
||||||
logger.info("[P2] Download ID: {}", getDownloadID());
|
logger.info("Download ID: {}", getDownloadID());
|
||||||
logger.info("[P2] Thanks for supporting us :)");
|
logger.info("Thanks for supporting us :)");
|
||||||
} else {
|
} else {
|
||||||
logger.info("[P2] Couldn't verify purchase :(");
|
logger.info("Couldn't verify purchase :(");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
@ -273,7 +274,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
if (!plotSquared.getConfigurationVersion().equalsIgnoreCase("v5")) {
|
if (!plotSquared.getConfigurationVersion().equalsIgnoreCase("v5")) {
|
||||||
// Perform upgrade
|
// Perform upgrade
|
||||||
if (DBFunc.dbManager.convertFlags()) {
|
if (DBFunc.dbManager.convertFlags()) {
|
||||||
logger.info("[P2] Flags were converted successfully!");
|
logger.info("Flags were converted successfully!");
|
||||||
// Update the config version
|
// Update the config version
|
||||||
try {
|
try {
|
||||||
plotSquared.setConfigurationVersion("v5");
|
plotSquared.setConfigurationVersion("v5");
|
||||||
@ -297,13 +298,13 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
// WorldEdit
|
// WorldEdit
|
||||||
if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) {
|
if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) {
|
||||||
try {
|
try {
|
||||||
logger.info("[P2] {} hooked into WorldEdit", this.getPluginName());
|
logger.info("{} hooked into WorldEdit", this.getPluginName());
|
||||||
WorldEdit.getInstance().getEventBus().register(this.getInjector().getInstance(WESubscriber.class));
|
WorldEdit.getInstance().getEventBus().register(this.getInjector().getInstance(WESubscriber.class));
|
||||||
if (Settings.Enabled_Components.COMMANDS) {
|
if (Settings.Enabled_Components.COMMANDS) {
|
||||||
new WE_Anywhere();
|
new WE_Anywhere();
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("[P2] Incompatible version of WorldEdit, please upgrade: https://builds.enginehub.org/job/worldedit?branch=master");
|
logger.error("Incompatible version of WorldEdit, please upgrade: https://builds.enginehub.org/job/worldedit?branch=master");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,7 +347,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
try {
|
try {
|
||||||
getInjector().getInstance(ComponentPresetManager.class);
|
getInjector().getInstance(ComponentPresetManager.class);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
logger.error("[P2] Failed to initialize the preset system", e);
|
logger.error("Failed to initialize the preset system", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,11 +370,11 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!worldUtil.isWorld(world) && !world.equals("*")) {
|
if (!worldUtil.isWorld(world) && !world.equals("*")) {
|
||||||
logger.warn("[P2] `{}` was not properly loaded - {} will now try to load it properly", world, this.getPluginName());
|
logger.warn("`{}` was not properly loaded - {} will now try to load it properly", world, this.getPluginName());
|
||||||
logger.warn(
|
logger.warn(
|
||||||
"[P2] - Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml");
|
" - Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml");
|
||||||
logger.warn("[P2] - Your world management plugin may be faulty (or non existent)");
|
logger.warn(" - Your world management plugin may be faulty (or non existent)");
|
||||||
logger.warn("[P2] This message may also be a false positive and could be ignored.");
|
logger.warn(" This message may also be a false positive and could be ignored.");
|
||||||
this.setGenerator(world);
|
this.setGenerator(world);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -393,7 +394,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
final OfflineModeUUIDService offlineModeUUIDService = new OfflineModeUUIDService();
|
final OfflineModeUUIDService offlineModeUUIDService = new OfflineModeUUIDService();
|
||||||
this.impromptuPipeline.registerService(offlineModeUUIDService);
|
this.impromptuPipeline.registerService(offlineModeUUIDService);
|
||||||
this.backgroundPipeline.registerService(offlineModeUUIDService);
|
this.backgroundPipeline.registerService(offlineModeUUIDService);
|
||||||
logger.info("[P2] (UUID) Using the offline mode UUID service");
|
logger.info("(UUID) Using the offline mode UUID service");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.UUID.SERVICE_BUKKIT) {
|
if (Settings.UUID.SERVICE_BUKKIT) {
|
||||||
@ -414,7 +415,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
final LuckPermsUUIDService luckPermsUUIDService;
|
final LuckPermsUUIDService luckPermsUUIDService;
|
||||||
if (Settings.UUID.SERVICE_LUCKPERMS && Bukkit.getPluginManager().getPlugin("LuckPerms") != null) {
|
if (Settings.UUID.SERVICE_LUCKPERMS && Bukkit.getPluginManager().getPlugin("LuckPerms") != null) {
|
||||||
luckPermsUUIDService = new LuckPermsUUIDService();
|
luckPermsUUIDService = new LuckPermsUUIDService();
|
||||||
logger.info("[P2] (UUID) Using LuckPerms as a complementary UUID service");
|
logger.info("(UUID) Using LuckPerms as a complementary UUID service");
|
||||||
} else {
|
} else {
|
||||||
luckPermsUUIDService = null;
|
luckPermsUUIDService = null;
|
||||||
}
|
}
|
||||||
@ -422,7 +423,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
final BungeePermsUUIDService bungeePermsUUIDService;
|
final BungeePermsUUIDService bungeePermsUUIDService;
|
||||||
if (Settings.UUID.SERVICE_BUNGEE_PERMS && Bukkit.getPluginManager().getPlugin("BungeePerms") != null) {
|
if (Settings.UUID.SERVICE_BUNGEE_PERMS && Bukkit.getPluginManager().getPlugin("BungeePerms") != null) {
|
||||||
bungeePermsUUIDService = new BungeePermsUUIDService();
|
bungeePermsUUIDService = new BungeePermsUUIDService();
|
||||||
logger.info("[P2] (UUID) Using BungeePerms as a complementary UUID service");
|
logger.info("(UUID) Using BungeePerms as a complementary UUID service");
|
||||||
} else {
|
} else {
|
||||||
bungeePermsUUIDService = null;
|
bungeePermsUUIDService = null;
|
||||||
}
|
}
|
||||||
@ -430,7 +431,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
final EssentialsUUIDService essentialsUUIDService;
|
final EssentialsUUIDService essentialsUUIDService;
|
||||||
if (Settings.UUID.SERVICE_ESSENTIALSX && Bukkit.getPluginManager().getPlugin("Essentials") != null) {
|
if (Settings.UUID.SERVICE_ESSENTIALSX && Bukkit.getPluginManager().getPlugin("Essentials") != null) {
|
||||||
essentialsUUIDService = new EssentialsUUIDService();
|
essentialsUUIDService = new EssentialsUUIDService();
|
||||||
logger.info("[P2] (UUID) Using EssentialsX as a complementary UUID service");
|
logger.info("(UUID) Using EssentialsX as a complementary UUID service");
|
||||||
} else {
|
} else {
|
||||||
essentialsUUIDService = null;
|
essentialsUUIDService = null;
|
||||||
}
|
}
|
||||||
@ -441,7 +442,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
final PaperUUIDService paperUUIDService = new PaperUUIDService();
|
final PaperUUIDService paperUUIDService = new PaperUUIDService();
|
||||||
this.impromptuPipeline.registerService(paperUUIDService);
|
this.impromptuPipeline.registerService(paperUUIDService);
|
||||||
this.backgroundPipeline.registerService(paperUUIDService);
|
this.backgroundPipeline.registerService(paperUUIDService);
|
||||||
logger.info("[P2] (UUID) Using Paper as a complementary UUID service");
|
logger.info("(UUID) Using Paper as a complementary UUID service");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.impromptuPipeline.registerService(sqLiteUUIDService);
|
this.impromptuPipeline.registerService(sqLiteUUIDService);
|
||||||
@ -495,17 +496,12 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
if (Settings.Enabled_Components.EXTERNAL_PLACEHOLDERS) {
|
if (Settings.Enabled_Components.EXTERNAL_PLACEHOLDERS) {
|
||||||
ChatFormatter.formatters.add(getInjector().getInstance(PlaceholderFormatter.class));
|
ChatFormatter.formatters.add(getInjector().getInstance(PlaceholderFormatter.class));
|
||||||
}
|
}
|
||||||
logger.info("[P2] PlotSquared hooked into PlaceholderAPI");
|
logger.info("PlotSquared hooked into PlaceholderAPI");
|
||||||
} else {
|
} else {
|
||||||
logger.info("[P2] PlaceholderAPI is not in use. Hook deactivated");
|
logger.info("PlaceholderAPI is not in use. Hook deactivated");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.Enabled_Components.BSTATS) {
|
|
||||||
this.startMetrics();
|
this.startMetrics();
|
||||||
}
|
|
||||||
else {
|
|
||||||
logger.info("[P2] bStats is disabled. Please enable it in /plugins/PlotSquared/config/settings.yml. It helps the developers to identify the features most used and organize future updates better. Cheers.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Settings.Enabled_Components.WORLDS) {
|
if (Settings.Enabled_Components.WORLDS) {
|
||||||
TaskManager.getPlatformImplementation().taskRepeat(this::unload, TaskTime.seconds(1L));
|
TaskManager.getPlatformImplementation().taskRepeat(this::unload, TaskTime.seconds(1L));
|
||||||
@ -574,7 +570,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
final Chunk[] chunks = world.getLoadedChunks();
|
final Chunk[] chunks = world.getLoadedChunks();
|
||||||
if (chunks.length == 0) {
|
if (chunks.length == 0) {
|
||||||
if (!Bukkit.unloadWorld(world, true)) {
|
if (!Bukkit.unloadWorld(world, true)) {
|
||||||
logger.warn("[P2] Failed to unload {}", world.getName());
|
logger.warn("Failed to unload {}", world.getName());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@ -623,7 +619,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.info("[P2] (UUID) {} UUIDs will be cached", uuidQueue.size());
|
logger.info("(UUID) {} UUIDs will be cached", uuidQueue.size());
|
||||||
|
|
||||||
Executors.newSingleThreadScheduledExecutor().schedule(() -> {
|
Executors.newSingleThreadScheduledExecutor().schedule(() -> {
|
||||||
// Begin by reading all the SQLite cache at once
|
// Begin by reading all the SQLite cache at once
|
||||||
@ -631,7 +627,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
// Now fetch names for all known UUIDs
|
// Now fetch names for all known UUIDs
|
||||||
final int totalSize = uuidQueue.size();
|
final int totalSize = uuidQueue.size();
|
||||||
int read = 0;
|
int read = 0;
|
||||||
logger.info("[P2] (UUID) PlotSquared will fetch UUIDs in groups of {}", Settings.UUID.BACKGROUND_LIMIT);
|
logger.info("(UUID) PlotSquared will fetch UUIDs in groups of {}", Settings.UUID.BACKGROUND_LIMIT);
|
||||||
final List<UUID> uuidList = new ArrayList<>(Settings.UUID.BACKGROUND_LIMIT);
|
final List<UUID> uuidList = new ArrayList<>(Settings.UUID.BACKGROUND_LIMIT);
|
||||||
|
|
||||||
// Used to indicate that the second retrieval has been attempted
|
// Used to indicate that the second retrieval has been attempted
|
||||||
@ -639,7 +635,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
|
|
||||||
while (!uuidQueue.isEmpty() || !uuidList.isEmpty()) {
|
while (!uuidQueue.isEmpty() || !uuidList.isEmpty()) {
|
||||||
if (!uuidList.isEmpty() && secondRun) {
|
if (!uuidList.isEmpty() && secondRun) {
|
||||||
logger.warn("[P2] (UUID) Giving up on last batch. Fetching new batch instead");
|
logger.warn("(UUID) Giving up on last batch. Fetching new batch instead");
|
||||||
uuidList.clear();
|
uuidList.clear();
|
||||||
}
|
}
|
||||||
if (uuidList.isEmpty()) {
|
if (uuidList.isEmpty()) {
|
||||||
@ -663,13 +659,13 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
// Print progress
|
// Print progress
|
||||||
final double percentage = ((double) read / (double) totalSize) * 100.0D;
|
final double percentage = ((double) read / (double) totalSize) * 100.0D;
|
||||||
if (Settings.DEBUG) {
|
if (Settings.DEBUG) {
|
||||||
logger.info("[P2] (UUID) PlotSquared has cached {} of UUIDs", String.format("%.1f%%", percentage));
|
logger.info("(UUID) PlotSquared has cached {} of UUIDs", String.format("%.1f%%", percentage));
|
||||||
}
|
}
|
||||||
} catch (final InterruptedException | ExecutionException e) {
|
} catch (final InterruptedException | ExecutionException e) {
|
||||||
logger.error("[P2] (UUID) Failed to retrieve last batch. Will try again", e);
|
logger.error("(UUID) Failed to retrieve last batch. Will try again", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.info("[P2] (UUID) PlotSquared has cached all UUIDs");
|
logger.info("(UUID) PlotSquared has cached all UUIDs");
|
||||||
}, 10, TimeUnit.SECONDS);
|
}, 10, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -701,7 +697,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation") private void runEntityTask() {
|
@SuppressWarnings("deprecation") private void runEntityTask() {
|
||||||
logger.info("[P2] KillAllEntities started");
|
logger.info("KillAllEntities started");
|
||||||
TaskManager.runTaskRepeat(() -> this.plotAreaManager.forEachPlotArea(plotArea -> {
|
TaskManager.runTaskRepeat(() -> this.plotAreaManager.forEachPlotArea(plotArea -> {
|
||||||
final World world = Bukkit.getWorld(plotArea.getWorldName());
|
final World world = Bukkit.getWorld(plotArea.getWorldName());
|
||||||
try {
|
try {
|
||||||
@ -1022,7 +1018,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
SetGenCB.setGenerator(BukkitUtil.getWorld(worldName));
|
SetGenCB.setGenerator(BukkitUtil.getWorld(worldName));
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
logger.error("[P2] Failed to reload world: {} | {}", world, e.getMessage());
|
logger.error("Failed to reload world: {} | {}", world, e.getMessage());
|
||||||
Bukkit.getServer().unloadWorld(world, false);
|
Bukkit.getServer().unloadWorld(world, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1093,4 +1089,15 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
return (PlayerManager<BukkitPlayer, Player>) getInjector().getInstance(PlayerManager.class);
|
return (PlayerManager<BukkitPlayer, Player>) getInjector().getInstance(PlayerManager.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override public void copyCaptionMaps() {
|
||||||
|
/* Make this prettier at some point */
|
||||||
|
final String[] languages = new String[] { "en" };
|
||||||
|
for (final String language : languages) {
|
||||||
|
if (!new File(new File(this.getDataFolder(), "lang"), String.format("messages_%s.json", language)).exists()) {
|
||||||
|
this.saveResource(String.format("lang/messages_%s.json", language), false);
|
||||||
|
logger.info("Copied language file 'messages_{}.json'", language);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.entity;
|
package com.plotsquared.bukkit.entity;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.entity;
|
package com.plotsquared.bukkit.entity;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.entity;
|
package com.plotsquared.bukkit.entity;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.entity;
|
package com.plotsquared.bukkit.entity;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.entity;
|
package com.plotsquared.bukkit.entity;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.entity;
|
package com.plotsquared.bukkit.entity;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.entity;
|
package com.plotsquared.bukkit.entity;
|
||||||
|
|
||||||
@ -391,7 +391,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|||||||
try {
|
try {
|
||||||
entity.getInventory().setContents(this.inventory);
|
entity.getInventory().setContents(this.inventory);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
logger.error("[P2] Failed to restore inventory", e);
|
logger.error("Failed to restore inventory", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -738,7 +738,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|||||||
return entity;
|
return entity;
|
||||||
default:
|
default:
|
||||||
if (Settings.DEBUG) {
|
if (Settings.DEBUG) {
|
||||||
logger.info("[P2] Could not identify entity: {}", entity.getType());
|
logger.info("Could not identify entity: {}", entity.getType());
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
// END LIVING
|
// END LIVING
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.entity;
|
package com.plotsquared.bukkit.entity;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.entity;
|
package com.plotsquared.bukkit.entity;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.generator;
|
package com.plotsquared.bukkit.generator;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.generator;
|
package com.plotsquared.bukkit.generator;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.generator;
|
package com.plotsquared.bukkit.generator;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.generator;
|
package com.plotsquared.bukkit.generator;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.inject;
|
package com.plotsquared.bukkit.inject;
|
||||||
|
|
||||||
@ -46,8 +46,8 @@ public class BackupModule extends AbstractModule {
|
|||||||
.implement(BackupProfile.class, PlayerBackupProfile.class).build(PlayerBackupProfileFactory.class));
|
.implement(BackupProfile.class, PlayerBackupProfile.class).build(PlayerBackupProfileFactory.class));
|
||||||
bind(BackupManager.class).to(SimpleBackupManager.class);
|
bind(BackupManager.class).to(SimpleBackupManager.class);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
logger.error("[P2] Failed to initialize backup manager", e);
|
logger.error("Failed to initialize backup manager", e);
|
||||||
logger.error("[P2] Backup features will be disabled");
|
logger.error("Backup features will be disabled");
|
||||||
bind(BackupManager.class).to(NullBackupManager.class);
|
bind(BackupManager.class).to(NullBackupManager.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.inject;
|
package com.plotsquared.bukkit.inject;
|
||||||
|
|
||||||
@ -84,6 +84,7 @@ public class BukkitModule extends AbstractModule {
|
|||||||
bind(PlayerManager.class).to(BukkitPlayerManager.class);
|
bind(PlayerManager.class).to(BukkitPlayerManager.class);
|
||||||
bind(JavaPlugin.class).toInstance(bukkitPlatform);
|
bind(JavaPlugin.class).toInstance(bukkitPlatform);
|
||||||
bind(PlotPlatform.class).toInstance(bukkitPlatform);
|
bind(PlotPlatform.class).toInstance(bukkitPlatform);
|
||||||
|
bind(BukkitPlatform.class).toInstance(bukkitPlatform);
|
||||||
bind(IndependentPlotGenerator.class).annotatedWith(DefaultGenerator.class).to(HybridGen.class);
|
bind(IndependentPlotGenerator.class).annotatedWith(DefaultGenerator.class).to(HybridGen.class);
|
||||||
// Console actor
|
// Console actor
|
||||||
@Nonnull ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
|
@Nonnull ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.inject;
|
package com.plotsquared.bukkit.inject;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.inject;
|
package com.plotsquared.bukkit.inject;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.listener;
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.listener;
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.listener;
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.listener;
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.listener;
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.listener;
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.listener;
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
@ -126,6 +126,7 @@ import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
|||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerLocaleChangeEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
@ -148,6 +149,7 @@ import java.lang.reflect.Field;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@ -1624,4 +1626,10 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler public void onLocaleChange(final PlayerLocaleChangeEvent event) {
|
||||||
|
BukkitPlayer player = BukkitUtil.adapt(event.getPlayer());
|
||||||
|
// we're stripping the country code as we con't want to differ between countries
|
||||||
|
player.setLocale(Locale.forLanguageTag(event.getLocale().substring(0, 2)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.listener;
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
@ -21,10 +21,11 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.listener;
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.bukkit.BukkitPlatform;
|
import com.plotsquared.bukkit.BukkitPlatform;
|
||||||
import com.plotsquared.bukkit.placeholder.MVdWPlaceholders;
|
import com.plotsquared.bukkit.placeholder.MVdWPlaceholders;
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
@ -35,11 +36,13 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.server.ServerLoadEvent;
|
import org.bukkit.event.server.ServerLoadEvent;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class ServerListener implements Listener {
|
public class ServerListener implements Listener {
|
||||||
|
|
||||||
private final BukkitPlatform plugin;
|
private final BukkitPlatform plugin;
|
||||||
|
|
||||||
public ServerListener(BukkitPlatform plugin) {
|
@Inject public ServerListener(@Nonnull final BukkitPlatform plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.listener;
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.listener;
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.managers;
|
package com.plotsquared.bukkit.managers;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.managers;
|
package com.plotsquared.bukkit.managers;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.managers;
|
package com.plotsquared.bukkit.managers;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.permissions;
|
package com.plotsquared.bukkit.permissions;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.permissions;
|
package com.plotsquared.bukkit.permissions;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.placeholder;
|
package com.plotsquared.bukkit.placeholder;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.placeholder;
|
package com.plotsquared.bukkit.placeholder;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.placeholder;
|
package com.plotsquared.bukkit.placeholder;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.player;
|
package com.plotsquared.bukkit.player;
|
||||||
|
|
||||||
@ -45,6 +45,9 @@ public class BukkitOfflinePlayer implements OfflinePlotPlayer {
|
|||||||
/**
|
/**
|
||||||
* Please do not use this method. Instead use BukkitUtil.getPlayer(Player),
|
* Please do not use this method. Instead use BukkitUtil.getPlayer(Player),
|
||||||
* as it caches player objects.
|
* as it caches player objects.
|
||||||
|
*
|
||||||
|
* @param player Bukkit OfflinePlayer player to convert
|
||||||
|
* @param permissionHandler Permission Profile to be used
|
||||||
*/
|
*/
|
||||||
public BukkitOfflinePlayer(@Nonnull final OfflinePlayer player, @Nonnull final
|
public BukkitOfflinePlayer(@Nonnull final OfflinePlayer player, @Nonnull final
|
||||||
PermissionHandler permissionHandler) {
|
PermissionHandler permissionHandler) {
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.player;
|
package com.plotsquared.bukkit.player;
|
||||||
|
|
||||||
@ -78,7 +78,11 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
|||||||
* <p>Please do not use this method. Instead use
|
* <p>Please do not use this method. Instead use
|
||||||
* BukkitUtil.getPlayer(Player), as it caches player objects.</p>
|
* BukkitUtil.getPlayer(Player), as it caches player objects.</p>
|
||||||
*
|
*
|
||||||
|
* @param plotAreaManager PlotAreaManager instance
|
||||||
|
* @param eventDispatcher EventDispatcher instance
|
||||||
* @param player Bukkit player instance
|
* @param player Bukkit player instance
|
||||||
|
* @param econHandler EconHandler instance
|
||||||
|
* @param permissionHandler PermissionHandler instance
|
||||||
*/
|
*/
|
||||||
public BukkitPlayer(@Nonnull final PlotAreaManager plotAreaManager, @Nonnull final EventDispatcher eventDispatcher,
|
public BukkitPlayer(@Nonnull final PlotAreaManager plotAreaManager, @Nonnull final EventDispatcher eventDispatcher,
|
||||||
@Nonnull final Player player, @Nullable final EconHandler econHandler, @Nonnull final PermissionHandler permissionHandler) {
|
@Nonnull final Player player, @Nullable final EconHandler econHandler, @Nonnull final PermissionHandler permissionHandler) {
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.player;
|
package com.plotsquared.bukkit.player;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.queue;
|
package com.plotsquared.bukkit.queue;
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ import java.util.function.Consumer;
|
|||||||
* and allows the caller to specify a sink for the loaded chunks. The
|
* and allows the caller to specify a sink for the loaded chunks. The
|
||||||
* coordinator will prevent the chunks from being unloaded until the sink
|
* coordinator will prevent the chunks from being unloaded until the sink
|
||||||
* has fully consumed the chunk
|
* has fully consumed the chunk
|
||||||
* <p>
|
* </p>
|
||||||
**/
|
**/
|
||||||
public final class BukkitChunkCoordinator extends ChunkCoordinator {
|
public final class BukkitChunkCoordinator extends ChunkCoordinator {
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.queue;
|
package com.plotsquared.bukkit.queue;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.queue;
|
package com.plotsquared.bukkit.queue;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.queue;
|
package com.plotsquared.bukkit.queue;
|
||||||
|
|
||||||
@ -71,6 +71,8 @@ public class GenChunk extends ScopedQueueCoordinator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the internal Bukkit chunk data
|
* Set the internal Bukkit chunk data
|
||||||
|
*
|
||||||
|
* @param chunkData Bukkit ChunkData
|
||||||
*/
|
*/
|
||||||
public void setChunkData(@Nonnull ChunkData chunkData) {
|
public void setChunkData(@Nonnull ChunkData chunkData) {
|
||||||
this.chunkData = chunkData;
|
this.chunkData = chunkData;
|
||||||
@ -88,6 +90,8 @@ public class GenChunk extends ScopedQueueCoordinator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the chunk being represented
|
* Set the chunk being represented
|
||||||
|
*
|
||||||
|
* @param chunk Bukkit Chunk
|
||||||
*/
|
*/
|
||||||
public void setChunk(@Nonnull Chunk chunk) {
|
public void setChunk(@Nonnull Chunk chunk) {
|
||||||
this.chunk = chunk;
|
this.chunk = chunk;
|
||||||
@ -96,6 +100,8 @@ public class GenChunk extends ScopedQueueCoordinator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the world and XZ of the chunk being represented via {@link ChunkWrapper}
|
* Set the world and XZ of the chunk being represented via {@link ChunkWrapper}
|
||||||
|
*
|
||||||
|
* @param wrap P2 ChunkWrapper
|
||||||
*/
|
*/
|
||||||
public void setChunk(@Nonnull ChunkWrapper wrap) {
|
public void setChunk(@Nonnull ChunkWrapper wrap) {
|
||||||
chunk = null;
|
chunk = null;
|
||||||
@ -146,6 +152,12 @@ public class GenChunk extends ScopedQueueCoordinator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the in the whole column of XZ
|
* Set the in the whole column of XZ
|
||||||
|
*
|
||||||
|
* @param x Relative x location within the chunk (0 - 15)
|
||||||
|
* @param z Relative z location within the chunk (0 - 15)
|
||||||
|
* @param biome Bukkit biome to set
|
||||||
|
*
|
||||||
|
* @return if successful
|
||||||
*/
|
*/
|
||||||
public boolean setBiome(int x, int z, @Nonnull Biome biome) {
|
public boolean setBiome(int x, int z, @Nonnull Biome biome) {
|
||||||
if (this.biomeGrid != null) {
|
if (this.biomeGrid != null) {
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.schematic;
|
package com.plotsquared.bukkit.schematic;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.schematic;
|
package com.plotsquared.bukkit.schematic;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.util;
|
package com.plotsquared.bukkit.util;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.util;
|
package com.plotsquared.bukkit.util;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.util;
|
package com.plotsquared.bukkit.util;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.util;
|
package com.plotsquared.bukkit.util;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.util;
|
package com.plotsquared.bukkit.util;
|
||||||
|
|
||||||
@ -32,6 +32,7 @@ import com.plotsquared.core.plot.PlotInventory;
|
|||||||
import com.plotsquared.core.plot.PlotItemStack;
|
import com.plotsquared.core.plot.PlotItemStack;
|
||||||
import com.plotsquared.core.util.InventoryUtil;
|
import com.plotsquared.core.util.InventoryUtil;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -49,11 +50,11 @@ import java.util.stream.IntStream;
|
|||||||
@Singleton public class BukkitInventoryUtil extends InventoryUtil {
|
@Singleton public class BukkitInventoryUtil extends InventoryUtil {
|
||||||
|
|
||||||
@Override public void open(PlotInventory inv) {
|
@Override public void open(PlotInventory inv) {
|
||||||
BukkitPlayer bp = (BukkitPlayer) inv.player;
|
BukkitPlayer bp = (BukkitPlayer) inv.getPlayer();
|
||||||
Inventory inventory = Bukkit.createInventory(null, inv.size * 9,
|
Inventory inventory = Bukkit.createInventory(null, inv.getLines() * 9,
|
||||||
ChatColor.translateAlternateColorCodes('&', inv.getTitle()));
|
ChatColor.translateAlternateColorCodes('&', inv.getTitle()));
|
||||||
PlotItemStack[] items = inv.getItems();
|
PlotItemStack[] items = inv.getItems();
|
||||||
for (int i = 0; i < inv.size * 9; i++) {
|
for (int i = 0; i < inv.getLines() * 9; i++) {
|
||||||
PlotItemStack item = items[i];
|
PlotItemStack item = items[i];
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
inventory.setItem(i, getItem(item));
|
inventory.setItem(i, getItem(item));
|
||||||
@ -66,12 +67,12 @@ import java.util.stream.IntStream;
|
|||||||
if (!inv.isOpen()) {
|
if (!inv.isOpen()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BukkitPlayer bp = (BukkitPlayer) inv.player;
|
BukkitPlayer bp = (BukkitPlayer) inv.getPlayer();
|
||||||
bp.player.closeInventory();
|
bp.player.closeInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void setItem(PlotInventory inv, int index, PlotItemStack item) {
|
@Override public void setItem(PlotInventory inv, int index, PlotItemStack item) {
|
||||||
BukkitPlayer bp = (BukkitPlayer) inv.player;
|
BukkitPlayer bp = (BukkitPlayer) inv.getPlayer();
|
||||||
InventoryView opened = bp.player.getOpenInventory();
|
InventoryView opened = bp.player.getOpenInventory();
|
||||||
if (!inv.isOpen()) {
|
if (!inv.isOpen()) {
|
||||||
return;
|
return;
|
||||||
@ -84,18 +85,19 @@ import java.util.stream.IntStream;
|
|||||||
if (item == null) {
|
if (item == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
ItemStack stack = new ItemStack(BukkitAdapter.adapt(item.getType()), item.amount);
|
ItemStack stack = new ItemStack(BukkitAdapter.adapt(item.getType()), item.getAmount());
|
||||||
ItemMeta meta = null;
|
ItemMeta meta = null;
|
||||||
if (item.name != null) {
|
if (item.getName() != null) {
|
||||||
meta = stack.getItemMeta();
|
meta = stack.getItemMeta();
|
||||||
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', item.name));
|
Component nameComponent = BukkitUtil.MINI_MESSAGE.parse(item.getName());
|
||||||
|
meta.setDisplayName(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(nameComponent));
|
||||||
}
|
}
|
||||||
if (item.lore != null) {
|
if (item.getLore() != null) {
|
||||||
if (meta == null) {
|
if (meta == null) {
|
||||||
meta = stack.getItemMeta();
|
meta = stack.getItemMeta();
|
||||||
}
|
}
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = new ArrayList<>();
|
||||||
for (String entry : item.lore) {
|
for (String entry : item.getLore()) {
|
||||||
lore.add(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(BukkitUtil.MINI_MESSAGE.deserialize(entry)));
|
lore.add(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(BukkitUtil.MINI_MESSAGE.deserialize(entry)));
|
||||||
}
|
}
|
||||||
meta.setLore(lore);
|
meta.setLore(lore);
|
||||||
@ -141,7 +143,7 @@ import java.util.stream.IntStream;
|
|||||||
if (!plotInventory.isOpen()) {
|
if (!plotInventory.isOpen()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
BukkitPlayer bp = (BukkitPlayer) plotInventory.player;
|
BukkitPlayer bp = (BukkitPlayer) plotInventory.getPlayer();
|
||||||
InventoryView opened = bp.player.getOpenInventory();
|
InventoryView opened = bp.player.getOpenInventory();
|
||||||
if (plotInventory.isOpen()) {
|
if (plotInventory.isOpen()) {
|
||||||
if (opened.getType() == InventoryType.CRAFTING) {
|
if (opened.getType() == InventoryType.CRAFTING) {
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.util;
|
package com.plotsquared.bukkit.util;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.util;
|
package com.plotsquared.bukkit.util;
|
||||||
|
|
||||||
@ -37,7 +37,6 @@ import com.plotsquared.core.inject.annotations.WorldConfig;
|
|||||||
import com.plotsquared.core.inject.annotations.WorldFile;
|
import com.plotsquared.core.inject.annotations.WorldFile;
|
||||||
import com.plotsquared.core.plot.PlotArea;
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
import com.plotsquared.core.plot.PlotAreaType;
|
import com.plotsquared.core.plot.PlotAreaType;
|
||||||
import com.plotsquared.core.plot.SetupObject;
|
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.setup.PlotAreaBuilder;
|
import com.plotsquared.core.setup.PlotAreaBuilder;
|
||||||
import com.plotsquared.core.util.SetupUtils;
|
import com.plotsquared.core.util.SetupUtils;
|
||||||
@ -118,111 +117,6 @@ import java.util.Objects;
|
|||||||
Bukkit.unloadWorld(world, false);
|
Bukkit.unloadWorld(world, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated @Override public String setupWorld(SetupObject object) {
|
|
||||||
this.updateGenerators();
|
|
||||||
ConfigurationNode[] steps = object.step == null ? new ConfigurationNode[0] : object.step;
|
|
||||||
String world = object.world;
|
|
||||||
PlotAreaType type = object.type;
|
|
||||||
String worldPath = "worlds." + object.world;
|
|
||||||
switch (type) {
|
|
||||||
case PARTIAL: {
|
|
||||||
if (object.id != null) {
|
|
||||||
if (!this.worldConfiguration.contains(worldPath)) {
|
|
||||||
this.worldConfiguration.createSection(worldPath);
|
|
||||||
}
|
|
||||||
ConfigurationSection worldSection = this.worldConfiguration.getConfigurationSection(worldPath);
|
|
||||||
String areaName = object.id + "-" + object.min + "-" + object.max;
|
|
||||||
String areaPath = "areas." + areaName;
|
|
||||||
if (!worldSection.contains(areaPath)) {
|
|
||||||
worldSection.createSection(areaPath);
|
|
||||||
}
|
|
||||||
ConfigurationSection areaSection =
|
|
||||||
worldSection.getConfigurationSection(areaPath);
|
|
||||||
HashMap<String, Object> options = new HashMap<>();
|
|
||||||
for (ConfigurationNode step : steps) {
|
|
||||||
options.put(step.getConstant(), step.getValue());
|
|
||||||
}
|
|
||||||
options.put("generator.type", object.type.toString());
|
|
||||||
options.put("generator.terrain", object.terrain.toString());
|
|
||||||
options.put("generator.plugin", object.plotManager);
|
|
||||||
if (object.setupGenerator != null && !object.setupGenerator
|
|
||||||
.equals(object.plotManager)) {
|
|
||||||
options.put("generator.init", object.setupGenerator);
|
|
||||||
}
|
|
||||||
for (Entry<String, Object> entry : options.entrySet()) {
|
|
||||||
String key = entry.getKey();
|
|
||||||
Object value = entry.getValue();
|
|
||||||
if (worldSection.contains(key)) {
|
|
||||||
Object current = worldSection.get(key);
|
|
||||||
if (!Objects.equals(value, current)) {
|
|
||||||
areaSection.set(key, value);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
worldSection.set(key, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
GeneratorWrapper<?> gen = SetupUtils.generators.get(object.setupGenerator);
|
|
||||||
if (gen != null && gen.isFull()) {
|
|
||||||
object.setupGenerator = null;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case AUGMENTED: {
|
|
||||||
if (!object.plotManager.endsWith(":single")) {
|
|
||||||
if (!this.worldConfiguration.contains(worldPath)) {
|
|
||||||
this.worldConfiguration.createSection(worldPath);
|
|
||||||
}
|
|
||||||
if (steps.length != 0) {
|
|
||||||
ConfigurationSection worldSection = this.worldConfiguration.getConfigurationSection(worldPath);
|
|
||||||
for (ConfigurationNode step : steps) {
|
|
||||||
worldSection.set(step.getConstant(), step.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.worldConfiguration.set("worlds." + world + ".generator.type", object.type.toString());
|
|
||||||
this.worldConfiguration.set("worlds." + world + ".generator.terrain", object.terrain.toString());
|
|
||||||
this.worldConfiguration.set("worlds." + world + ".generator.plugin", object.plotManager);
|
|
||||||
if (object.setupGenerator != null && !object.setupGenerator
|
|
||||||
.equals(object.plotManager)) {
|
|
||||||
this.worldConfiguration.set("worlds." + world + ".generator.init", object.setupGenerator);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
GeneratorWrapper<?> gen = SetupUtils.generators.get(object.setupGenerator);
|
|
||||||
if (gen != null && gen.isFull()) {
|
|
||||||
object.setupGenerator = null;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case NORMAL: {
|
|
||||||
if (steps.length != 0) {
|
|
||||||
if (!this.worldConfiguration.contains(worldPath)) {
|
|
||||||
this.worldConfiguration.createSection(worldPath);
|
|
||||||
}
|
|
||||||
ConfigurationSection worldSection = this.worldConfiguration.getConfigurationSection(worldPath);
|
|
||||||
for (ConfigurationNode step : steps) {
|
|
||||||
worldSection.set(step.getConstant(), step.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
this.worldConfiguration.save(this.worldFile);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
Objects.requireNonNull(PlotSquared.platform()).getWorldManager()
|
|
||||||
.handleWorldCreation(object.world, object.setupGenerator);
|
|
||||||
|
|
||||||
if (Bukkit.getWorld(world) != null) {
|
|
||||||
return world;
|
|
||||||
}
|
|
||||||
|
|
||||||
return object.world;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String setupWorld(PlotAreaBuilder builder) {
|
@Override public String setupWorld(PlotAreaBuilder builder) {
|
||||||
this.updateGenerators();
|
this.updateGenerators();
|
||||||
ConfigurationNode[] steps = builder.settingsNodesWrapper() == null ?
|
ConfigurationNode[] steps = builder.settingsNodesWrapper() == null ?
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.util;
|
package com.plotsquared.bukkit.util;
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ public class BukkitUtil extends WorldUtil {
|
|||||||
private static final Logger logger = LoggerFactory.getLogger("P2/" + BukkitUtil.class.getSimpleName());
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + BukkitUtil.class.getSimpleName());
|
||||||
|
|
||||||
public static final BukkitAudiences BUKKIT_AUDIENCES = BukkitAudiences.create(BukkitPlatform.getPlugin(BukkitPlatform.class));
|
public static final BukkitAudiences BUKKIT_AUDIENCES = BukkitAudiences.create(BukkitPlatform.getPlugin(BukkitPlatform.class));
|
||||||
public static final LegacyComponentSerializer LEGACY_COMPONENT_SERIALIZER = LegacyComponentSerializer.legacyAmpersand();
|
public static final LegacyComponentSerializer LEGACY_COMPONENT_SERIALIZER = LegacyComponentSerializer.legacySection();
|
||||||
public static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
|
public static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
|
||||||
|
|
||||||
private final Collection<BlockType> tileEntityTypes = new HashSet<>();
|
private final Collection<BlockType> tileEntityTypes = new HashSet<>();
|
||||||
@ -334,7 +334,7 @@ public class BukkitUtil extends WorldUtil {
|
|||||||
final Sign sign = (Sign) blockstate;
|
final Sign sign = (Sign) blockstate;
|
||||||
for (int i = 0; i < lines.length; i++) {
|
for (int i = 0; i < lines.length; i++) {
|
||||||
sign.setLine(i, LEGACY_COMPONENT_SERIALIZER
|
sign.setLine(i, LEGACY_COMPONENT_SERIALIZER
|
||||||
.serialize(MINI_MESSAGE.parse(lines[i].getComponent(LocaleHolder.console()))));
|
.serialize(MINI_MESSAGE.parse(lines[i].getComponent(LocaleHolder.console()), replacements)));
|
||||||
}
|
}
|
||||||
sign.update(true);
|
sign.update(true);
|
||||||
}
|
}
|
||||||
@ -349,7 +349,7 @@ public class BukkitUtil extends WorldUtil {
|
|||||||
@Override public void setBiomes(@Nonnull final String worldName, @Nonnull final CuboidRegion region, @Nonnull final BiomeType biomeType) {
|
@Override public void setBiomes(@Nonnull final String worldName, @Nonnull final CuboidRegion region, @Nonnull final BiomeType biomeType) {
|
||||||
final World world = getWorld(worldName);
|
final World world = getWorld(worldName);
|
||||||
if (world == null) {
|
if (world == null) {
|
||||||
logger.warn("[P2] An error occured while setting the biome because the world was null", new RuntimeException());
|
logger.warn("An error occurred while setting the biome because the world was null", new RuntimeException());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Biome biome = BukkitAdapter.adapt(biomeType);
|
final Biome biome = BukkitAdapter.adapt(biomeType);
|
||||||
@ -459,7 +459,7 @@ public class BukkitUtil extends WorldUtil {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
logger.error("[P2] Unknown entity category requested: {}", category);
|
logger.error("Unknown entity category requested: {}", category);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.util;
|
package com.plotsquared.bukkit.util;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.util;
|
package com.plotsquared.bukkit.util;
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ public class ContentMap {
|
|||||||
try {
|
try {
|
||||||
entity.spawn(world, xOffset, zOffset);
|
entity.spawn(world, xOffset, zOffset);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("[P2] Failed to restore entity", e);
|
logger.error("Failed to restore entity", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.entities.clear();
|
this.entities.clear();
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.util;
|
package com.plotsquared.bukkit.util;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.util;
|
package com.plotsquared.bukkit.util;
|
||||||
|
|
||||||
@ -72,22 +72,22 @@ public class UpdateUtility implements Listener {
|
|||||||
.getAsJsonObject();
|
.getAsJsonObject();
|
||||||
spigotVersion = result.get("current_version").getAsString();
|
spigotVersion = result.get("current_version").getAsString();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error("[P2] Unable to check for updates. Error: {}", e.getMessage());
|
logger.error("Unable to check for updates. Error: {}", e.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (internalVersion.isLaterVersion(spigotVersion)) {
|
if (internalVersion.isLaterVersion(spigotVersion)) {
|
||||||
logger.info("[P2] There appears to be a PlotSquared update available!");
|
logger.info("There appears to be a PlotSquared update available!");
|
||||||
logger.info("[P2] You are running version {}, the latest version is {}",
|
logger.info("You are running version {}, the latest version is {}",
|
||||||
internalVersion.versionString(), spigotVersion);
|
internalVersion.versionString(), spigotVersion);
|
||||||
logger.info("[P2] https://www.spigotmc.org/resources/77506/updates");
|
logger.info("https://www.spigotmc.org/resources/77506/updates");
|
||||||
hasUpdate = true;
|
hasUpdate = true;
|
||||||
if (Settings.UpdateChecker.NOTIFY_ONCE) {
|
if (Settings.UpdateChecker.NOTIFY_ONCE) {
|
||||||
cancelTask();
|
cancelTask();
|
||||||
}
|
}
|
||||||
} else if (notify) {
|
} else if (notify) {
|
||||||
notify = false;
|
notify = false;
|
||||||
logger.info("[P2] Congratulations! You are running the latest PlotSquared version");
|
logger.info("Congratulations! You are running the latest PlotSquared version");
|
||||||
}
|
}
|
||||||
}, 0L, Settings.UpdateChecker.POLL_RATE * 60 * 20);
|
}, 0L, Settings.UpdateChecker.POLL_RATE * 60 * 20);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.util.task;
|
package com.plotsquared.bukkit.util.task;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.util.task;
|
package com.plotsquared.bukkit.util.task;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.util.task;
|
package com.plotsquared.bukkit.util.task;
|
||||||
|
|
||||||
@ -36,12 +36,14 @@ import javax.annotation.Nonnegative;
|
|||||||
*/
|
*/
|
||||||
public final class PaperTimeConverter implements TaskTime.TimeConverter {
|
public final class PaperTimeConverter implements TaskTime.TimeConverter {
|
||||||
|
|
||||||
|
private static final long MIN_MS_PER_TICKS = 50L;
|
||||||
|
|
||||||
@Override public long msToTicks(@Nonnegative final long ms) {
|
@Override public long msToTicks(@Nonnegative final long ms) {
|
||||||
return Math.max(1L, (long) (ms / Bukkit.getAverageTickTime()));
|
return Math.max(1L, (long) (ms / Math.max(MIN_MS_PER_TICKS, Bukkit.getAverageTickTime())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public long ticksToMs(@Nonnegative final long ticks) {
|
@Override public long ticksToMs(@Nonnegative final long ticks) {
|
||||||
return Math.max(1L, (long) (ticks * Bukkit.getAverageTickTime()));
|
return Math.max(1L, (long) (ticks * Math.max(MIN_MS_PER_TICKS, Bukkit.getAverageTickTime())));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.util.task;
|
package com.plotsquared.bukkit.util.task;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.uuid;
|
package com.plotsquared.bukkit.uuid;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.uuid;
|
package com.plotsquared.bukkit.uuid;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.uuid;
|
package com.plotsquared.bukkit.uuid;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.uuid;
|
package com.plotsquared.bukkit.uuid;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.uuid;
|
package com.plotsquared.bukkit.uuid;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.uuid;
|
package com.plotsquared.bukkit.uuid;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.uuid;
|
package com.plotsquared.bukkit.uuid;
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ public class SquirrelIdUUIDService implements UUIDService {
|
|||||||
//
|
//
|
||||||
if (uuids.size() >= 2) {
|
if (uuids.size() >= 2) {
|
||||||
if (Settings.DEBUG) {
|
if (Settings.DEBUG) {
|
||||||
logger.info("[P2] (UUID) Found invalid UUID in batch. Will try each UUID individually.");
|
logger.info("(UUID) Found invalid UUID in batch. Will try each UUID individually.");
|
||||||
}
|
}
|
||||||
for (final UUID uuid : uuids) {
|
for (final UUID uuid : uuids) {
|
||||||
final List<UUIDMapping> result = this.getNames(Collections.singletonList(uuid));
|
final List<UUIDMapping> result = this.getNames(Collections.singletonList(uuid));
|
||||||
@ -92,7 +92,7 @@ public class SquirrelIdUUIDService implements UUIDService {
|
|||||||
results.add(result.get(0));
|
results.add(result.get(0));
|
||||||
}
|
}
|
||||||
} else if (uuids.size() == 1 && Settings.DEBUG) {
|
} else if (uuids.size() == 1 && Settings.DEBUG) {
|
||||||
logger.info("[P2] (UUID) Found invalid UUID: {}", uuids.get(0));
|
logger.info("(UUID) Found invalid UUID: {}", uuids.get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException | InterruptedException e) {
|
} catch (IOException | InterruptedException e) {
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core;
|
package com.plotsquared.core;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core;
|
package com.plotsquared.core;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core;
|
package com.plotsquared.core;
|
||||||
|
|
||||||
@ -86,11 +86,13 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the version of Minecraft that is running.
|
* Gets the version of Minecraft that is running.
|
||||||
|
* @return server version as array of numbers
|
||||||
*/
|
*/
|
||||||
int[] getServerVersion();
|
int[] getServerVersion();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the server implementation name and version
|
* Gets the server implementation name and version
|
||||||
|
* @return server implementationa and version as string
|
||||||
*/
|
*/
|
||||||
String getServerImplementation();
|
String getServerImplementation();
|
||||||
|
|
||||||
@ -254,6 +256,11 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
|||||||
*/
|
*/
|
||||||
@Nonnull Audience getConsoleAudience();
|
@Nonnull Audience getConsoleAudience();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the caption maps
|
||||||
|
*/
|
||||||
|
void copyCaptionMaps();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link PermissionHandler} implementation for the platform
|
* Get the {@link PermissionHandler} implementation for the platform
|
||||||
*
|
*
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core;
|
package com.plotsquared.core;
|
||||||
|
|
||||||
@ -90,7 +90,6 @@ import java.net.MalformedURLException;
|
|||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.nio.file.StandardOpenOption;
|
import java.nio.file.StandardOpenOption;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
@ -141,7 +140,7 @@ public class PlotSquared {
|
|||||||
public HashMap<String, HashMap<PlotId, Plot>> plots_tmp;
|
public HashMap<String, HashMap<PlotId, Plot>> plots_tmp;
|
||||||
private YamlConfiguration config;
|
private YamlConfiguration config;
|
||||||
// Localization
|
// Localization
|
||||||
private Map<String, CaptionMap> captionMaps;
|
private final Map<String, CaptionMap> captionMaps = new HashMap<>();
|
||||||
// Platform / Version / Update URL
|
// Platform / Version / Update URL
|
||||||
private PlotVersion version;
|
private PlotVersion version;
|
||||||
// Files and configuration
|
// Files and configuration
|
||||||
@ -174,6 +173,13 @@ public class PlotSquared {
|
|||||||
//
|
//
|
||||||
ConfigurationSerialization.registerClass(BlockBucket.class, "BlockBucket");
|
ConfigurationSerialization.registerClass(BlockBucket.class, "BlockBucket");
|
||||||
|
|
||||||
|
// Load caption map
|
||||||
|
try {
|
||||||
|
this.loadCaptionMap();
|
||||||
|
} catch (final Exception e) {
|
||||||
|
logger.error("Failed to load caption map", e);
|
||||||
|
}
|
||||||
|
|
||||||
// Setup the global flag container
|
// Setup the global flag container
|
||||||
GlobalFlagContainer.setup();
|
GlobalFlagContainer.setup();
|
||||||
|
|
||||||
@ -197,8 +203,6 @@ public class PlotSquared {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.captionMaps = new HashMap<>();
|
|
||||||
|
|
||||||
this.worldedit = WorldEdit.getInstance();
|
this.worldedit = WorldEdit.getInstance();
|
||||||
|
|
||||||
// Create Event utility class
|
// Create Event utility class
|
||||||
@ -224,16 +228,19 @@ public class PlotSquared {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadCaptionMap() throws IOException {
|
public void loadCaptionMap() throws Exception {
|
||||||
|
this.platform.copyCaptionMaps();
|
||||||
// Setup localization
|
// Setup localization
|
||||||
CaptionMap captionMap;
|
CaptionMap captionMap;
|
||||||
if (Settings.Enabled_Components.PER_USER_LOCALE) {
|
if (Settings.Enabled_Components.PER_USER_LOCALE) {
|
||||||
captionMap = CaptionLoader.loadAll(Paths.get("lang"));
|
captionMap = CaptionLoader.loadAll(new File(this.platform.getDirectory(), "lang").toPath());
|
||||||
} else {
|
} else {
|
||||||
String fileName = "messages_" + Settings.Enabled_Components.DEFAULT_LOCALE + ".json";
|
String fileName = "messages_" + Settings.Enabled_Components.DEFAULT_LOCALE + ".json";
|
||||||
captionMap = CaptionLoader.loadSingle(Paths.get("lang", fileName));
|
captionMap = CaptionLoader.loadSingle(new File(new File(this.platform.getDirectory(), "lang"), fileName).toPath());
|
||||||
}
|
}
|
||||||
this.captionMaps.put(TranslatableCaption.DEFAULT_NAMESPACE, captionMap);
|
this.captionMaps.put(TranslatableCaption.DEFAULT_NAMESPACE, captionMap);
|
||||||
|
logger.info("Loaded caption map for namespace 'plotsquared': {}",
|
||||||
|
this.captionMaps.get(TranslatableCaption.DEFAULT_NAMESPACE).getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -384,16 +391,16 @@ public class PlotSquared {
|
|||||||
regionInts.forEach(l -> regions.add(BlockVector2.at(l[0], l[1])));
|
regionInts.forEach(l -> regions.add(BlockVector2.at(l[0], l[1])));
|
||||||
chunkInts.forEach(l -> chunks.add(BlockVector2.at(l[0], l[1])));
|
chunkInts.forEach(l -> chunks.add(BlockVector2.at(l[0], l[1])));
|
||||||
int height = (int) list.get(2);
|
int height = (int) list.get(2);
|
||||||
logger.info("[P2] Incomplete road regeneration found. Restarting in world {} with height {}", plotArea.getWorldName(), height);
|
logger.info("Incomplete road regeneration found. Restarting in world {} with height {}", plotArea.getWorldName(), height);
|
||||||
logger.info("[P2] - Regions: {}", regions.size());
|
logger.info(" - Regions: {}", regions.size());
|
||||||
logger.info("[P2] - Chunks: {}", chunks.size());
|
logger.info(" - Chunks: {}", chunks.size());
|
||||||
HybridUtils.UPDATE = true;
|
HybridUtils.UPDATE = true;
|
||||||
PlotSquared.platform().getHybridUtils().scheduleRoadUpdate(plotArea, regions, height, chunks);
|
PlotSquared.platform().getHybridUtils().scheduleRoadUpdate(plotArea, regions, height, chunks);
|
||||||
} catch (IOException | ClassNotFoundException e) {
|
} catch (IOException | ClassNotFoundException e) {
|
||||||
logger.error("[P2] Error restarting road regeneration", e);
|
logger.error("Error restarting road regeneration", e);
|
||||||
} finally {
|
} finally {
|
||||||
if (!file.delete()) {
|
if (!file.delete()) {
|
||||||
logger.error("[P2] Error deleting persistent_regen_data_{}. Please delete this file manually", plotArea.getId());
|
logger.error("Error deleting persistent_regen_data_{}. Please delete this file manually", plotArea.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -796,10 +803,10 @@ public class PlotSquared {
|
|||||||
// Conventional plot generator
|
// Conventional plot generator
|
||||||
PlotArea plotArea = plotGenerator.getNewPlotArea(world, null, null, null);
|
PlotArea plotArea = plotGenerator.getNewPlotArea(world, null, null, null);
|
||||||
PlotManager plotManager = plotArea.getPlotManager();
|
PlotManager plotManager = plotArea.getPlotManager();
|
||||||
logger.info("[P2] Detected world load for '{}'", world);
|
logger.info("Detected world load for '{}'", world);
|
||||||
logger.info("[P2] - generator: {}>{}", baseGenerator, plotGenerator);
|
logger.info(" - generator: {}>{}", baseGenerator, plotGenerator);
|
||||||
logger.info("[P2] - plot world: {}", plotArea.getClass().getCanonicalName());
|
logger.info(" - plot world: {}", plotArea.getClass().getCanonicalName());
|
||||||
logger.info("[P2] - plot area manager: {}", plotManager.getClass().getCanonicalName());
|
logger.info("- plot area manager: {}", plotManager.getClass().getCanonicalName());
|
||||||
if (!this.worldConfiguration.contains(path)) {
|
if (!this.worldConfiguration.contains(path)) {
|
||||||
this.worldConfiguration.createSection(path);
|
this.worldConfiguration.createSection(path);
|
||||||
worldSection = this.worldConfiguration.getConfigurationSection(path);
|
worldSection = this.worldConfiguration.getConfigurationSection(path);
|
||||||
@ -823,7 +830,7 @@ public class PlotSquared {
|
|||||||
if (getPlotAreaManager().getPlotAreas(world, null).length != 0) {
|
if (getPlotAreaManager().getPlotAreas(world, null).length != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logger.info("[P2] Detected world load for '{}'", world);
|
logger.info("Detected world load for '{}'", world);
|
||||||
String gen_string = worldSection.getString("generator.plugin", platform.getPluginName());
|
String gen_string = worldSection.getString("generator.plugin", platform.getPluginName());
|
||||||
if (type == PlotAreaType.PARTIAL) {
|
if (type == PlotAreaType.PARTIAL) {
|
||||||
Set<PlotCluster> clusters =
|
Set<PlotCluster> clusters =
|
||||||
@ -839,7 +846,7 @@ public class PlotSquared {
|
|||||||
String fullId = name + "-" + pos1 + "-" + pos2;
|
String fullId = name + "-" + pos1 + "-" + pos2;
|
||||||
worldSection.createSection("areas." + fullId);
|
worldSection.createSection("areas." + fullId);
|
||||||
DBFunc.replaceWorld(world, world + ";" + name, pos1, pos2); // NPE
|
DBFunc.replaceWorld(world, world + ";" + name, pos1, pos2); // NPE
|
||||||
logger.info("[P2] - {}-{}-{}", name, pos1, pos2);
|
logger.info(" - {}-{}-{}", name, pos1, pos2);
|
||||||
GeneratorWrapper<?> areaGen = this.platform.getGenerator(world, gen_string);
|
GeneratorWrapper<?> areaGen = this.platform.getGenerator(world, gen_string);
|
||||||
if (areaGen == null) {
|
if (areaGen == null) {
|
||||||
throw new IllegalArgumentException("Invalid Generator: " + gen_string);
|
throw new IllegalArgumentException("Invalid Generator: " + gen_string);
|
||||||
@ -853,10 +860,10 @@ public class PlotSquared {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
logger.info("[P2] | generator: {}>{}", baseGenerator, areaGen);
|
logger.info(" | generator: {}>{}", baseGenerator, areaGen);
|
||||||
logger.info("[P2] | plot world: {}", pa);
|
logger.info(" | plot world: {}", pa);
|
||||||
logger.info("[P2] | manager: {}", pa);
|
logger.info(" | manager: {}", pa);
|
||||||
logger.info("[P2] Note: Area created for cluster '{}' (invalid or old configuration?)", name);
|
logger.info("Note: Area created for cluster '{}' (invalid or old configuration?)", name);
|
||||||
areaGen.getPlotGenerator().initialize(pa);
|
areaGen.getPlotGenerator().initialize(pa);
|
||||||
areaGen.augment(pa);
|
areaGen.augment(pa);
|
||||||
toLoad.add(pa);
|
toLoad.add(pa);
|
||||||
@ -878,9 +885,9 @@ public class PlotSquared {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
logger.info("[P2] - generator: {}>{}", baseGenerator, areaGen);
|
logger.info(" - generator: {}>{}", baseGenerator, areaGen);
|
||||||
logger.info("[P2] - plot world: {}", pa);
|
logger.info(" - plot world: {}", pa);
|
||||||
logger.info("[P2] - plot area manager: {}", pa.getPlotManager());
|
logger.info(" - plot area manager: {}", pa.getPlotManager());
|
||||||
areaGen.getPlotGenerator().initialize(pa);
|
areaGen.getPlotGenerator().initialize(pa);
|
||||||
areaGen.augment(pa);
|
areaGen.augment(pa);
|
||||||
addPlotArea(pa);
|
addPlotArea(pa);
|
||||||
@ -892,7 +899,7 @@ public class PlotSquared {
|
|||||||
+ PlotAreaType.AUGMENTED + "`");
|
+ PlotAreaType.AUGMENTED + "`");
|
||||||
}
|
}
|
||||||
for (String areaId : areasSection.getKeys(false)) {
|
for (String areaId : areasSection.getKeys(false)) {
|
||||||
logger.info("[P2] - {}", areaId);
|
logger.info(" - {}", areaId);
|
||||||
String[] split = areaId.split("(?<=[^;-])-");
|
String[] split = areaId.split("(?<=[^;-])-");
|
||||||
if (split.length != 3) {
|
if (split.length != 3) {
|
||||||
throw new IllegalArgumentException("Invalid Area identifier: " + areaId
|
throw new IllegalArgumentException("Invalid Area identifier: " + areaId
|
||||||
@ -954,10 +961,10 @@ public class PlotSquared {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
logger.info("[P2] Detected area load for '{}'", world);
|
logger.info("Detected area load for '{}'", world);
|
||||||
logger.info("[P2] | generator: {}>{}", baseGenerator, areaGen);
|
logger.info(" | generator: {}>{}", baseGenerator, areaGen);
|
||||||
logger.info("[P2] | plot world: {}", pa);
|
logger.info(" | plot world: {}", pa);
|
||||||
logger.info("[P2] | manager: {}", pa.getPlotManager());
|
logger.info(" | manager: {}", pa.getPlotManager());
|
||||||
areaGen.getPlotGenerator().initialize(pa);
|
areaGen.getPlotGenerator().initialize(pa);
|
||||||
areaGen.augment(pa);
|
areaGen.augment(pa);
|
||||||
addPlotArea(pa);
|
addPlotArea(pa);
|
||||||
@ -1028,7 +1035,7 @@ public class PlotSquared {
|
|||||||
for (String element : split) {
|
for (String element : split) {
|
||||||
String[] pair = element.split("=");
|
String[] pair = element.split("=");
|
||||||
if (pair.length != 2) {
|
if (pair.length != 2) {
|
||||||
logger.error("[P2] No value provided for '{}'", element);
|
logger.error("No value provided for '{}'", element);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String key = pair[0].toLowerCase();
|
String key = pair[0].toLowerCase();
|
||||||
@ -1076,11 +1083,11 @@ public class PlotSquared {
|
|||||||
ConfigurationUtil.BLOCK_BUCKET.parseString(value).toString());
|
ConfigurationUtil.BLOCK_BUCKET.parseString(value).toString());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
logger.error("[P2] Key not found: {}", element);
|
logger.error("Key not found: {}", element);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("[P2] Invalid value '{}' for arg '{}'", value, element);
|
logger.error("Invalid value '{}' for arg '{}'", value, element);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1148,7 +1155,7 @@ public class PlotSquared {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error("[P2] Could not save {}", file);
|
logger.error("Could not save {}", file);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1171,7 +1178,7 @@ public class PlotSquared {
|
|||||||
// Close the connection
|
// Close the connection
|
||||||
DBFunc.close();
|
DBFunc.close();
|
||||||
} catch (NullPointerException throwable) {
|
} catch (NullPointerException throwable) {
|
||||||
logger.error("[P2] Could not close database connection", throwable);
|
logger.error("Could not close database connection", throwable);
|
||||||
throwable.printStackTrace();
|
throwable.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1184,9 +1191,9 @@ public class PlotSquared {
|
|||||||
HybridUtils.regions.isEmpty() && HybridUtils.chunks.isEmpty())) {
|
HybridUtils.regions.isEmpty() && HybridUtils.chunks.isEmpty())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logger.info("[P2] Road regeneration incomplete. Saving incomplete regions to disk");
|
logger.info("Road regeneration incomplete. Saving incomplete regions to disk");
|
||||||
logger.info("[P2] - regions: {}", HybridUtils.regions.size());
|
logger.info(" - regions: {}", HybridUtils.regions.size());
|
||||||
logger.info("[P2] - chunks: {}", HybridUtils.chunks.size());
|
logger.info(" - chunks: {}", HybridUtils.chunks.size());
|
||||||
ArrayList<int[]> regions = new ArrayList<>();
|
ArrayList<int[]> regions = new ArrayList<>();
|
||||||
ArrayList<int[]> chunks = new ArrayList<>();
|
ArrayList<int[]> chunks = new ArrayList<>();
|
||||||
for (BlockVector2 r : HybridUtils.regions) {
|
for (BlockVector2 r : HybridUtils.regions) {
|
||||||
@ -1203,14 +1210,14 @@ public class PlotSquared {
|
|||||||
this.platform.getDirectory() + File.separator + "persistent_regen_data_" + HybridUtils.area
|
this.platform.getDirectory() + File.separator + "persistent_regen_data_" + HybridUtils.area
|
||||||
.getId() + "_" + HybridUtils.area.getWorldName());
|
.getId() + "_" + HybridUtils.area.getWorldName());
|
||||||
if (file.exists() && !file.delete()) {
|
if (file.exists() && !file.delete()) {
|
||||||
logger.error("[P2] persistent_regene_data file already exists and could not be deleted");
|
logger.error("persistent_regene_data file already exists and could not be deleted");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try (ObjectOutputStream oos = new ObjectOutputStream(
|
try (ObjectOutputStream oos = new ObjectOutputStream(
|
||||||
Files.newOutputStream(file.toPath(), StandardOpenOption.CREATE_NEW))) {
|
Files.newOutputStream(file.toPath(), StandardOpenOption.CREATE_NEW))) {
|
||||||
oos.writeObject(list);
|
oos.writeObject(list);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error("[P2] Error creating persistent_region_data file", e);
|
logger.error("Error creating persistent_region_data file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1230,7 +1237,7 @@ public class PlotSquared {
|
|||||||
File file = FileUtils.getFile(platform.getDirectory(), Storage.SQLite.DB + ".db");
|
File file = FileUtils.getFile(platform.getDirectory(), Storage.SQLite.DB + ".db");
|
||||||
database = new SQLite(file);
|
database = new SQLite(file);
|
||||||
} else {
|
} else {
|
||||||
logger.error("[P2] No storage type is set. Disabling PlotSquared");
|
logger.error("No storage type is set. Disabling PlotSquared");
|
||||||
this.platform.shutdown(); //shutdown used instead of disable because no database is set
|
this.platform.shutdown(); //shutdown used instead of disable because no database is set
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1248,11 +1255,11 @@ public class PlotSquared {
|
|||||||
}
|
}
|
||||||
this.clustersTmp = DBFunc.getClusters();
|
this.clustersTmp = DBFunc.getClusters();
|
||||||
} catch (ClassNotFoundException | SQLException e) {
|
} catch (ClassNotFoundException | SQLException e) {
|
||||||
logger.error("[P2] Failed to open database connection ({}). Disabling PlotSquared", Storage.MySQL.USE ? "MySQL" : "SQLite");
|
logger.error("Failed to open database connection ({}). Disabling PlotSquared", Storage.MySQL.USE ? "MySQL" : "SQLite");
|
||||||
logger.error("[P2] ==== Here is an ugly stacktrace, if you are interested in those things ===");
|
logger.error("==== Here is an ugly stacktrace, if you are interested in those things ===");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.error("[P2] &d==== End of stacktrace ====");
|
logger.error("==== End of stacktrace ====");
|
||||||
logger.error("[P2] &6Please go to the {} 'storage.yml' and configure the database correctly",
|
logger.error("Please go to the {} 'storage.yml' and configure the database correctly",
|
||||||
platform.getPluginName());
|
platform.getPluginName());
|
||||||
this.platform.shutdown(); //shutdown used instead of disable because of database error
|
this.platform.shutdown(); //shutdown used instead of disable because of database error
|
||||||
}
|
}
|
||||||
@ -1278,7 +1285,7 @@ public class PlotSquared {
|
|||||||
try {
|
try {
|
||||||
worldConfiguration.save(worldsFile);
|
worldConfiguration.save(worldsFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error("[P2] Failed to save worlds.yml", e);
|
logger.error("Failed to save worlds.yml", e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1306,16 +1313,18 @@ public class PlotSquared {
|
|||||||
* Setup all configuration files<br>
|
* Setup all configuration files<br>
|
||||||
* - Config: settings.yml<br>
|
* - Config: settings.yml<br>
|
||||||
* - Storage: storage.yml<br>
|
* - Storage: storage.yml<br>
|
||||||
|
*
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public boolean setupConfigs() {
|
public boolean setupConfigs() {
|
||||||
File folder = new File(this.platform.getDirectory(), "config");
|
File folder = new File(this.platform.getDirectory(), "config");
|
||||||
if (!folder.exists() && !folder.mkdirs()) {
|
if (!folder.exists() && !folder.mkdirs()) {
|
||||||
logger.error("[P2] Failed to create the /plugins/config folder. Please create it manually");
|
logger.error("Failed to create the /plugins/PlotSquared/config folder. Please create it manually");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.worldsFile = new File(folder, "worlds.yml");
|
this.worldsFile = new File(folder, "worlds.yml");
|
||||||
if (!this.worldsFile.exists() && !this.worldsFile.createNewFile()) {
|
if (!this.worldsFile.exists() && !this.worldsFile.createNewFile()) {
|
||||||
logger.error("[P2] Could not create the worlds file. Please create 'worlds.yml' manually");
|
logger.error("Could not create the worlds file. Please create 'worlds.yml' manually");
|
||||||
}
|
}
|
||||||
this.worldConfiguration = YamlConfiguration.loadConfiguration(this.worldsFile);
|
this.worldConfiguration = YamlConfiguration.loadConfiguration(this.worldsFile);
|
||||||
|
|
||||||
@ -1325,20 +1334,20 @@ public class PlotSquared {
|
|||||||
.equalsIgnoreCase(LegacyConverter.CONFIGURATION_VERSION) && !this.worldConfiguration
|
.equalsIgnoreCase(LegacyConverter.CONFIGURATION_VERSION) && !this.worldConfiguration
|
||||||
.getString("configuration_version").equalsIgnoreCase("v5"))) {
|
.getString("configuration_version").equalsIgnoreCase("v5"))) {
|
||||||
// Conversion needed
|
// Conversion needed
|
||||||
logger.info("[P2] &aA legacy configuration file was detected. Conversion will be attempted.");
|
logger.info("A legacy configuration file was detected. Conversion will be attempted.");
|
||||||
try {
|
try {
|
||||||
com.google.common.io.Files
|
com.google.common.io.Files
|
||||||
.copy(this.worldsFile, new File(folder, "worlds.yml.old"));
|
.copy(this.worldsFile, new File(folder, "worlds.yml.old"));
|
||||||
logger.info("[P2] &6A copy of worlds.yml has been saved in the file worlds.yml.old");
|
logger.info("A copy of worlds.yml has been saved in the file worlds.yml.old");
|
||||||
final ConfigurationSection worlds =
|
final ConfigurationSection worlds =
|
||||||
this.worldConfiguration.getConfigurationSection("worlds");
|
this.worldConfiguration.getConfigurationSection("worlds");
|
||||||
final LegacyConverter converter = new LegacyConverter(worlds);
|
final LegacyConverter converter = new LegacyConverter(worlds);
|
||||||
converter.convert();
|
converter.convert();
|
||||||
this.worldConfiguration.set("worlds", worlds);
|
this.worldConfiguration.set("worlds", worlds);
|
||||||
this.setConfigurationVersion(LegacyConverter.CONFIGURATION_VERSION);
|
this.setConfigurationVersion(LegacyConverter.CONFIGURATION_VERSION);
|
||||||
logger.info("[P2] &aThe conversion has finished. PlotSquared will now be disabled and the new configuration file will be used at next startup. Please review the new worlds.yml file. Please note that schematics will not be converted, as we are now using WorldEdit to handle schematics. You need to re-generate the schematics.");
|
logger.info("The conversion has finished. PlotSquared will now be disabled and the new configuration file will be used at next startup. Please review the new worlds.yml file. Please note that schematics will not be converted, as we are now using WorldEdit to handle schematics. You need to re-generate the schematics.");
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
logger.error("[P2] &cFailed to convert the legacy configuration file. See stack trace for information.", e);
|
logger.error("Failed to convert the legacy configuration file. See stack trace for information.", e);
|
||||||
}
|
}
|
||||||
// Disable plugin
|
// Disable plugin
|
||||||
this.platform.shutdown();
|
this.platform.shutdown();
|
||||||
@ -1348,27 +1357,27 @@ public class PlotSquared {
|
|||||||
this.worldConfiguration.set("configuration_version", LegacyConverter.CONFIGURATION_VERSION);
|
this.worldConfiguration.set("configuration_version", LegacyConverter.CONFIGURATION_VERSION);
|
||||||
}
|
}
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
logger.error("[P2] Failed to save worlds.yml");
|
logger.error("Failed to save worlds.yml");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.configFile = new File(folder, "settings.yml");
|
this.configFile = new File(folder, "settings.yml");
|
||||||
if (!this.configFile.exists() && !this.configFile.createNewFile()) {
|
if (!this.configFile.exists() && !this.configFile.createNewFile()) {
|
||||||
logger.error("[P2] Could not create the settings file. Please create 'settings.yml' manually");
|
logger.error("Could not create the settings file. Please create 'settings.yml' manually");
|
||||||
}
|
}
|
||||||
this.config = YamlConfiguration.loadConfiguration(this.configFile);
|
this.config = YamlConfiguration.loadConfiguration(this.configFile);
|
||||||
setupConfig();
|
setupConfig();
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
logger.error("[P2] Failed to save settings.yml");
|
logger.error("Failed to save settings.yml");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.storageFile = new File(folder, "storage.yml");
|
this.storageFile = new File(folder, "storage.yml");
|
||||||
if (!this.storageFile.exists() && !this.storageFile.createNewFile()) {
|
if (!this.storageFile.exists() && !this.storageFile.createNewFile()) {
|
||||||
logger.error("[P2] Could not create the storage settings file. Please create 'storage.yml' manually");
|
logger.error("Could not create the storage settings file. Please create 'storage.yml' manually");
|
||||||
}
|
}
|
||||||
YamlConfiguration.loadConfiguration(this.storageFile);
|
YamlConfiguration.loadConfiguration(this.storageFile);
|
||||||
setupStorage();
|
setupStorage();
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
logger.error("[P2] Failed to save storage.yml");
|
logger.error("Failed to save storage.yml");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1399,7 +1408,7 @@ public class PlotSquared {
|
|||||||
if (Settings.DEBUG) {
|
if (Settings.DEBUG) {
|
||||||
Map<String, Object> components = Settings.getFields(Settings.Enabled_Components.class);
|
Map<String, Object> components = Settings.getFields(Settings.Enabled_Components.class);
|
||||||
for (Entry<String, Object> component : components.entrySet()) {
|
for (Entry<String, Object> component : components.entrySet()) {
|
||||||
logger.info("[P2] Key: {} | Value: {}", component.getKey(), component.getValue());
|
logger.info("Key: {} | Value: {}", component.getKey(), component.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core;
|
package com.plotsquared.core;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.backup;
|
package com.plotsquared.core.backup;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.backup;
|
package com.plotsquared.core.backup;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.backup;
|
package com.plotsquared.core.backup;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.backup;
|
package com.plotsquared.core.backup;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.backup;
|
package com.plotsquared.core.backup;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.backup;
|
package com.plotsquared.core.backup;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.backup;
|
package com.plotsquared.core.backup;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.collection;
|
package com.plotsquared.core.collection;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.collection;
|
package com.plotsquared.core.collection;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.collection;
|
package com.plotsquared.core.collection;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.collection;
|
package com.plotsquared.core.collection;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.collection;
|
package com.plotsquared.core.collection;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.collection;
|
package com.plotsquared.core.collection;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.command;
|
package com.plotsquared.core.command;
|
||||||
|
|
||||||
@ -48,7 +48,6 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
|
|
||||||
@CommandDeclaration(command = "add",
|
@CommandDeclaration(command = "add",
|
||||||
description = "Allow a user to build in a plot while the plot owner is online.",
|
|
||||||
usage = "/plot add <player | *>",
|
usage = "/plot add <player | *>",
|
||||||
category = CommandCategory.SETTINGS,
|
category = CommandCategory.SETTINGS,
|
||||||
permission = "plots.add",
|
permission = "plots.add",
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.command;
|
package com.plotsquared.core.command;
|
||||||
|
|
||||||
@ -44,7 +44,6 @@ import java.util.concurrent.TimeoutException;
|
|||||||
|
|
||||||
@CommandDeclaration(command = "alias",
|
@CommandDeclaration(command = "alias",
|
||||||
permission = "plots.alias",
|
permission = "plots.alias",
|
||||||
description = "Set the plot name",
|
|
||||||
usage = "/plot alias <set | remove> <alias>",
|
usage = "/plot alias <set | remove> <alias>",
|
||||||
aliases = {"setalias", "sa", "name", "rename", "setname", "seta", "nameplot"},
|
aliases = {"setalias", "sa", "name", "rename", "setname", "seta", "nameplot"},
|
||||||
category = CommandCategory.SETTINGS,
|
category = CommandCategory.SETTINGS,
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.command;
|
package com.plotsquared.core.command;
|
||||||
|
|
||||||
@ -93,7 +93,6 @@ import java.util.UUID;
|
|||||||
permission = "plots.area",
|
permission = "plots.area",
|
||||||
category = CommandCategory.ADMINISTRATION,
|
category = CommandCategory.ADMINISTRATION,
|
||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
description = "Create a new PlotArea",
|
|
||||||
aliases = "world",
|
aliases = "world",
|
||||||
usage = "/plot area <create | info | list | tp | regen>",
|
usage = "/plot area <create | info | list | tp | regen>",
|
||||||
confirmation = true)
|
confirmation = true)
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.command;
|
package com.plotsquared.core.command;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.command;
|
package com.plotsquared.core.command;
|
||||||
|
|
||||||
@ -64,7 +64,6 @@ import java.util.stream.Collectors;
|
|||||||
permission = "plots.auto",
|
permission = "plots.auto",
|
||||||
category = CommandCategory.CLAIMING,
|
category = CommandCategory.CLAIMING,
|
||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
description = "Claim the nearest plot",
|
|
||||||
aliases = "a",
|
aliases = "a",
|
||||||
usage = "/plot auto [length, width]")
|
usage = "/plot auto [length, width]")
|
||||||
public class Auto extends SubCommand {
|
public class Auto extends SubCommand {
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.command;
|
package com.plotsquared.core.command;
|
||||||
|
|
||||||
@ -57,7 +57,6 @@ import java.util.stream.Stream;
|
|||||||
|
|
||||||
@CommandDeclaration(command = "backup",
|
@CommandDeclaration(command = "backup",
|
||||||
usage = "/plot backup <save | list | load>",
|
usage = "/plot backup <save | list | load>",
|
||||||
description = "Manage plot backups",
|
|
||||||
category = CommandCategory.SETTINGS,
|
category = CommandCategory.SETTINGS,
|
||||||
requiredType = RequiredType.PLAYER,
|
requiredType = RequiredType.PLAYER,
|
||||||
permission = "plots.backup")
|
permission = "plots.backup")
|
||||||
@ -123,7 +122,6 @@ public final class Backup extends Command {
|
|||||||
|
|
||||||
@CommandDeclaration(command = "save",
|
@CommandDeclaration(command = "save",
|
||||||
usage = "/plot backup save",
|
usage = "/plot backup save",
|
||||||
description = "Create a plot backup",
|
|
||||||
category = CommandCategory.SETTINGS,
|
category = CommandCategory.SETTINGS,
|
||||||
requiredType = RequiredType.PLAYER,
|
requiredType = RequiredType.PLAYER,
|
||||||
permission = "plots.backup.save")
|
permission = "plots.backup.save")
|
||||||
@ -174,7 +172,6 @@ public final class Backup extends Command {
|
|||||||
|
|
||||||
@CommandDeclaration(command = "list",
|
@CommandDeclaration(command = "list",
|
||||||
usage = "/plot backup list",
|
usage = "/plot backup list",
|
||||||
description = "List available plot backups",
|
|
||||||
category = CommandCategory.SETTINGS,
|
category = CommandCategory.SETTINGS,
|
||||||
requiredType = RequiredType.PLAYER,
|
requiredType = RequiredType.PLAYER,
|
||||||
permission = "plots.backup.list")
|
permission = "plots.backup.list")
|
||||||
@ -241,7 +238,6 @@ public final class Backup extends Command {
|
|||||||
|
|
||||||
@CommandDeclaration(command = "load",
|
@CommandDeclaration(command = "load",
|
||||||
usage = "/plot backup load <#>",
|
usage = "/plot backup load <#>",
|
||||||
description = "Restore a plot backup",
|
|
||||||
category = CommandCategory.SETTINGS,
|
category = CommandCategory.SETTINGS,
|
||||||
requiredType = RequiredType.PLAYER,
|
requiredType = RequiredType.PLAYER,
|
||||||
permission = "plots.backup.load")
|
permission = "plots.backup.load")
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.command;
|
package com.plotsquared.core.command;
|
||||||
|
|
||||||
@ -40,7 +40,6 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
@CommandDeclaration(command = "setbiome",
|
@CommandDeclaration(command = "setbiome",
|
||||||
permission = "plots.set.biome",
|
permission = "plots.set.biome",
|
||||||
description = "Set the plot biome",
|
|
||||||
usage = "/plot biome [biome]",
|
usage = "/plot biome [biome]",
|
||||||
aliases = {"biome", "sb", "setb", "b"},
|
aliases = {"biome", "sb", "setb", "b"},
|
||||||
category = CommandCategory.APPEARANCE,
|
category = CommandCategory.APPEARANCE,
|
||||||
@ -67,7 +66,7 @@ public class Biome extends SetCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plot.addRunning();
|
plot.addRunning();
|
||||||
plot.setBiome(biome, () -> {
|
plot.getPlotModificationManager().setBiome(biome, () -> {
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("biome.biome_set_to"),
|
TranslatableCaption.of("biome.biome_set_to"),
|
||||||
@ -78,8 +77,7 @@ public class Biome extends SetCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<Command> tab(final PlotPlayer player, final String[] args,
|
public Collection<Command> tab(final PlotPlayer<?> player, final String[] args, final boolean space) {
|
||||||
final boolean space) {
|
|
||||||
return SuggestionHelper.getNamespacedRegistrySuggestions(BiomeType.REGISTRY, args[0])
|
return SuggestionHelper.getNamespacedRegistrySuggestions(BiomeType.REGISTRY, args[0])
|
||||||
.map(value -> value.toLowerCase(Locale.ENGLISH).replace("minecraft:", ""))
|
.map(value -> value.toLowerCase(Locale.ENGLISH).replace("minecraft:", ""))
|
||||||
.filter(value -> value.startsWith(args[0].toLowerCase(Locale.ENGLISH)))
|
.filter(value -> value.startsWith(args[0].toLowerCase(Locale.ENGLISH)))
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.command;
|
package com.plotsquared.core.command;
|
||||||
|
|
||||||
@ -46,7 +46,6 @@ import java.util.Set;
|
|||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
@CommandDeclaration(command = "buy",
|
@CommandDeclaration(command = "buy",
|
||||||
description = "Buy the plot you are standing on",
|
|
||||||
usage = "/plot buy",
|
usage = "/plot buy",
|
||||||
permission = "plots.buy",
|
permission = "plots.buy",
|
||||||
category = CommandCategory.CLAIMING,
|
category = CommandCategory.CLAIMING,
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.command;
|
package com.plotsquared.core.command;
|
||||||
|
|
||||||
@ -47,7 +47,6 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
|
|||||||
|
|
||||||
@CommandDeclaration(command = "caps",
|
@CommandDeclaration(command = "caps",
|
||||||
category = CommandCategory.INFO,
|
category = CommandCategory.INFO,
|
||||||
description = "Show plot entity caps",
|
|
||||||
usage = "/plot caps")
|
usage = "/plot caps")
|
||||||
public class Caps extends SubCommand {
|
public class Caps extends SubCommand {
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.command;
|
package com.plotsquared.core.command;
|
||||||
|
|
||||||
@ -29,7 +29,6 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
|||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(command = "chat",
|
@CommandDeclaration(command = "chat",
|
||||||
description = "Toggles plot chat on or off",
|
|
||||||
usage = "/plot chat",
|
usage = "/plot chat",
|
||||||
permission = "plots.chat",
|
permission = "plots.chat",
|
||||||
category = CommandCategory.CHAT,
|
category = CommandCategory.CHAT,
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.plotsquared.core.command;
|
package com.plotsquared.core.command;
|
||||||
|
|
||||||
@ -55,7 +55,6 @@ import javax.annotation.Nullable;
|
|||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "claim",
|
command = "claim",
|
||||||
aliases = "c",
|
aliases = "c",
|
||||||
description = "Claim the current plot you're standing on",
|
|
||||||
category = CommandCategory.CLAIMING,
|
category = CommandCategory.CLAIMING,
|
||||||
requiredType = RequiredType.PLAYER, permission = "plots.claim",
|
requiredType = RequiredType.PLAYER, permission = "plots.claim",
|
||||||
usage = "/plot claim")
|
usage = "/plot claim")
|
||||||
@ -175,8 +174,7 @@ public class Claim extends SubCommand {
|
|||||||
try {
|
try {
|
||||||
TaskManager.getPlatformImplementation().sync(() -> {
|
TaskManager.getPlatformImplementation().sync(() -> {
|
||||||
if (!plot.claim(player, true, finalSchematic, false)) {
|
if (!plot.claim(player, true, finalSchematic, false)) {
|
||||||
logger.info(TranslatableCaption.of("core.prefix") + String
|
logger.info("Failed to claim plot {}", plot.getId().toCommaSeparatedString());
|
||||||
.format("Failed to claim plot %s", plot.getId().toCommaSeparatedString()));
|
|
||||||
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
|
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
|
||||||
plot.setOwnerAbs(null);
|
plot.setOwnerAbs(null);
|
||||||
} else if (area.isAutoMerge()) {
|
} else if (area.isAutoMerge()) {
|
||||||
@ -188,7 +186,7 @@ public class Claim extends SubCommand {
|
|||||||
Template.of("value", "Auto merge on claim")
|
Template.of("value", "Auto merge on claim")
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
plot.autoMerge(mergeEvent.getDir(), mergeEvent.getMax(), player.getUUID(), true);
|
plot.getPlotModificationManager().autoMerge(mergeEvent.getDir(), mergeEvent.getMax(), player.getUUID(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -197,9 +195,7 @@ public class Claim extends SubCommand {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}, () -> {
|
}, () -> {
|
||||||
logger.info(TranslatableCaption.of("core.prefix") + String
|
logger.info("Failed to add plot to database: {}", plot.getId().toCommaSeparatedString());
|
||||||
.format("Failed to add plot %s to the database",
|
|
||||||
plot.getId().toCommaSeparatedString()));
|
|
||||||
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
|
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
|
||||||
plot.setOwnerAbs(null);
|
plot.setOwnerAbs(null);
|
||||||
});
|
});
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user