Compare commits

..
17 Commits
Author SHA1 Message Date
md5sha256 68651899b7 Update the fawe module 2022-01-10 22:59:03 +08:00
md5sha256 4a7a4ca4ee Fix reobf 2022-01-10 22:34:35 +08:00
md5sha256 0d272c8fe9 Publish nms provider poms 2021-12-05 23:07:05 +08:00
md5sha256 6b2c905939 Parallel builds 2021-12-05 22:57:17 +08:00
md5sha256 7ab782799b Fix maven publish tasks 2021-12-05 22:57:03 +08:00
md5sha256 bea82eae88 Fix maven publish tasks 2021-12-05 22:56:37 +08:00
md5sha256 4ac0e045bd Add maven publish task 2021-12-05 18:22:41 +08:00
md5sha256 e5061b218e Java 17 and 1.18 2021-12-01 17:59:17 +08:00
md5sha256 40fdfba47d Fix silly typo in the buildscript 2021-11-18 22:16:36 +08:00
md5sha256 e9260cede6 Bump gradle wrapper version to 7.3 2021-11-18 22:14:56 +08:00
md5sha256 bb297c9ff1 Bump version 2021-11-16 15:28:14 +08:00
Andrew Wong 666742ad56 Merge pull request #2 from md5sha256/feature/purge 2021-11-16 15:25:54 +08:00
md5sha256 36eb8c3a5e Fix imports 2021-11-16 15:25:01 +08:00
Olzie-12 06a9f7b28e file management 2021-11-14 14:41:41 +00:00
md5sha256 e101780420 Fix compat for file manager 2021-11-11 13:31:09 +08:00
md5sha256 6abe99e807 Log sign warnings to the sign error logger 2021-11-09 19:06:02 +08:00
md5sha256 a1d18521ee Introduce interface for FileManager 2021-10-11 00:00:57 +08:00
54 changed files with 955 additions and 181 deletions

No files matched your search

+41 -9
View File
@@ -2,9 +2,11 @@ import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.0'
id 'maven-publish'
id 'java-library'
}
version = "2.7.0-SNAPSHOT"
version = "2.7.2"
dependencies {
implementation 'com.github.NLthijs48:InteractiveMessenger:e7749258ca'
@@ -20,15 +22,16 @@ dependencies {
implementation project(':areashop-interface')
implementation project(':areashop-bukkit-1_13')
implementation project(':areashop-nms')
implementation project(':areashop-nms-1-17')
runtimeOnly project(path: ':areashop-nms-1-17', configuration: 'reobf')
runtimeOnly project(path: ':areashop-nms-1-18', configuration: 'reobf')
implementation project(':areashop-worldedit-7')
implementation project(':areashop-worldguard-7')
implementation project(':areashop-fastasyncworldedit')
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
compileOnly ('com.sk89q.worldedit:worldedit-bukkit:7.2.5') {
compileOnly 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT'
compileOnly ('com.sk89q.worldedit:worldedit-bukkit:7.2.8') {
exclude group: 'com.google.guava'
}
compileOnly ('com.sk89q.worldguard:worldguard-bukkit:7.0.5') {
compileOnly ('com.sk89q.worldguard:worldguard-bukkit:7.0.6') {
exclude group: 'com.google.guava'
}
compileOnly ('com.github.MilkBowl:VaultAPI:1.7')
@@ -44,16 +47,15 @@ processResources {
assemble {
dependsOn(shadowJar)
dependsOn(publishToMavenLocal)
}
jar {
archiveClassifier.set('original')
}
compileJava {
javaToolchains.compilerFor {
JavaLanguageVersion.of(16)
}
java {
withSourcesJar()
}
shadowJar {
@@ -73,4 +75,34 @@ shadowJar {
}
}
sourcesJar {
classifier('sources')
from sourceSets.main.allSource
}
publishing {
publications {
// ... artifact publications
areaShop(MavenPublication) {
from components.java
pom {
group = "me.wiefferink"
artifactId = "$project.name"
version = "$project.version"
scm {
connection = 'scm:git:git://github.com/md5sha256/AreaShop.git'
developerConnection = 'scm:git:ssh://github.com/md5sha256/AreaShop.git'
url = "https://github.com/md5sha256/AreaShop/tree/dev/bleeding"
}
licenses {
license {
name = 'GNU General Public License v3.0'
url = "https://github.com/md5sha256/AreaShop/blob/dev/bleeding/LICENSE"
}
}
}
}
}
}
description = 'AreaShop'
@@ -14,6 +14,7 @@ import me.wiefferink.areashop.interfaces.WorldGuardInterface;
import me.wiefferink.areashop.listeners.PlayerLoginLogoutListener;
import me.wiefferink.areashop.managers.CommandManager;
import me.wiefferink.areashop.managers.FeatureManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.Manager;
import me.wiefferink.areashop.managers.SignErrorLogger;
@@ -69,7 +70,7 @@ public final class AreaShop extends JavaPlugin implements AreaShopApi {
private NMS nms;
private BukkitInterface bukkitInterface = null;
private MessageBridge messageBridge;
private FileManager fileManager = null;
private IFileManager fileManager = null;
private LanguageManager languageManager = null;
private CommandManager commandManager = null;
private SignLinkerManager signLinkerManager = null;
@@ -343,8 +344,8 @@ public final class AreaShop extends JavaPlugin implements AreaShopApi {
injector = Guice.createInjector(Stage.PRODUCTION, new BukkitModule(getServer()), asModule);
// Load all data from files and check versions
fileManager = injector.getInstance(FileManager.class);
managers.add(fileManager);
fileManager = injector.getInstance(IFileManager.class);
managers.add((FileManager) fileManager);
boolean loadFilesResult = fileManager.loadFiles(false);
error = error || !loadFilesResult;
@@ -660,7 +661,7 @@ public final class AreaShop extends JavaPlugin implements AreaShopApi {
* Method to get the FileManager (loads/save regions and can be used to get regions).
* @return The fileManager
*/
public FileManager getFileManager() {
public IFileManager getFileManager() {
return fileManager;
}
@@ -11,7 +11,7 @@ import me.wiefferink.areashop.events.notify.RentedRegionEvent;
import me.wiefferink.areashop.interfaces.WorldEditInterface;
import me.wiefferink.areashop.interfaces.WorldEditSelection;
import me.wiefferink.areashop.interfaces.WorldGuardInterface;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.BuyRegion;
import me.wiefferink.areashop.regions.GeneralRegion;
import me.wiefferink.areashop.regions.RegionFactory;
@@ -164,14 +164,14 @@ public class AddCommand extends CommandAreaShop {
} else {
type = "buy";
}
FileManager.AddResult result = plugin.getFileManager().checkRegionAdd(sender, region, world, isRent ? GeneralRegion.RegionType.RENT : GeneralRegion.RegionType.BUY);
if(result == FileManager.AddResult.ALREADYADDED) {
IFileManager.AddResult result = plugin.getFileManager().checkRegionAdd(sender, region, world, isRent ? GeneralRegion.RegionType.RENT : GeneralRegion.RegionType.BUY);
if(result == IFileManager.AddResult.ALREADYADDED) {
regionsAlready.add(plugin.getFileManager().getRegion(regionName));
} else if(result == FileManager.AddResult.ALREADYADDEDOTHERWORLD) {
} else if(result == IFileManager.AddResult.ALREADYADDEDOTHERWORLD) {
regionsAlreadyOtherWorld.add(plugin.getFileManager().getRegion(regionName));
} else if(result == FileManager.AddResult.BLACKLISTED) {
} else if(result == IFileManager.AddResult.BLACKLISTED) {
namesBlacklisted.add(regionName);
} else if(result == FileManager.AddResult.NOPERMISSION) {
} else if(result == IFileManager.AddResult.NOPERMISSION) {
namesNoPermission.add(regionName);
} else {
// Check if the player should be landlord
@@ -1,7 +1,7 @@
package me.wiefferink.areashop.commands;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.BuyRegion;
import me.wiefferink.areashop.regions.GeneralRegion;
import me.wiefferink.areashop.regions.RentRegion;
@@ -23,7 +23,7 @@ public class AddfriendCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Inject
private Plugin plugin;
@@ -4,7 +4,7 @@ import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.features.signs.RegionSign;
import me.wiefferink.areashop.features.signs.SignManager;
import me.wiefferink.areashop.interfaces.BukkitInterface;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.GeneralRegion;
import me.wiefferink.areashop.tools.Materials;
import me.wiefferink.areashop.tools.Utils;
@@ -28,7 +28,7 @@ public class AddsignCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Inject
private SignManager signManager;
@Inject
@@ -1,7 +1,7 @@
package me.wiefferink.areashop.commands;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.BuyRegion;
import me.wiefferink.areashop.tools.Utils;
import org.bukkit.command.CommandSender;
@@ -21,7 +21,7 @@ public class BuyCommand extends CommandAreaShop {
@Inject
private Plugin plugin;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Override
public String getCommandStart() {
@@ -4,7 +4,7 @@ import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.events.ask.DeletingRegionEvent;
import me.wiefferink.areashop.interfaces.WorldEditInterface;
import me.wiefferink.areashop.interfaces.WorldEditSelection;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.BuyRegion;
import me.wiefferink.areashop.regions.GeneralRegion;
import me.wiefferink.areashop.regions.RentRegion;
@@ -26,7 +26,7 @@ public class DelCommand extends CommandAreaShop {
@Inject
private WorldEditInterface worldEditInterface;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Override
public String getCommandStart() {
@@ -1,7 +1,7 @@
package me.wiefferink.areashop.commands;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.BuyRegion;
import me.wiefferink.areashop.regions.GeneralRegion;
import me.wiefferink.areashop.regions.RentRegion;
@@ -22,7 +22,7 @@ public class DelfriendCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Override
public String getCommandStart() {
@@ -1,7 +1,7 @@
package me.wiefferink.areashop.commands;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.BuyRegion;
import me.wiefferink.areashop.regions.RegionGroup;
import me.wiefferink.areashop.regions.RentRegion;
@@ -27,7 +27,7 @@ public class FindCommand extends CommandAreaShop {
@Inject
private Economy economy;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Override
public String getCommandStart() {
@@ -3,7 +3,7 @@ package me.wiefferink.areashop.commands;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.interfaces.WorldEditInterface;
import me.wiefferink.areashop.interfaces.WorldEditSelection;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.GeneralRegion;
import me.wiefferink.areashop.regions.RegionFactory;
import me.wiefferink.areashop.regions.RegionGroup;
@@ -23,7 +23,7 @@ public class GroupaddCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Inject
private RegionFactory regionFactory;
@Inject
@@ -3,7 +3,7 @@ package me.wiefferink.areashop.commands;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.interfaces.WorldEditInterface;
import me.wiefferink.areashop.interfaces.WorldEditSelection;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.GeneralRegion;
import me.wiefferink.areashop.regions.RegionFactory;
import me.wiefferink.areashop.regions.RegionGroup;
@@ -23,7 +23,7 @@ public class GroupdelCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Inject
private RegionFactory regionFactory;
@Inject
@@ -1,7 +1,7 @@
package me.wiefferink.areashop.commands;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.RegionGroup;
import me.wiefferink.areashop.tools.Utils;
import org.bukkit.command.CommandSender;
@@ -18,7 +18,7 @@ public class GroupinfoCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Override
public String getCommandStart() {
@@ -1,7 +1,7 @@
package me.wiefferink.areashop.commands;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.tools.Utils;
import org.bukkit.command.CommandSender;
@@ -16,7 +16,7 @@ public class GrouplistCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Override
public String getCommandStart() {
@@ -2,14 +2,13 @@ package me.wiefferink.areashop.commands;
import io.github.bakedlibs.dough.blocks.BlockPosition;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.BuyRegion;
import me.wiefferink.areashop.regions.GeneralRegion;
import me.wiefferink.areashop.regions.RegionGroup;
import me.wiefferink.areashop.regions.RentRegion;
import me.wiefferink.areashop.tools.Utils;
import me.wiefferink.interactivemessenger.processing.Message;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -17,7 +16,6 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -30,7 +28,7 @@ public class InfoCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Override
public String getCommandStart() {
@@ -1,7 +1,7 @@
package me.wiefferink.areashop.commands;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.BuyRegion;
import me.wiefferink.areashop.regions.GeneralRegion;
import me.wiefferink.areashop.regions.RentRegion;
@@ -24,7 +24,7 @@ public class MeCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Override
public String getCommandStart() {
@@ -1,7 +1,7 @@
package me.wiefferink.areashop.commands;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.RentRegion;
import me.wiefferink.areashop.tools.Utils;
import org.bukkit.command.CommandSender;
@@ -18,7 +18,7 @@ public class RentCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Override
public String getCommandStart() {
@@ -1,7 +1,7 @@
package me.wiefferink.areashop.commands;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.BuyRegion;
import me.wiefferink.areashop.tools.Utils;
import org.bukkit.command.CommandSender;
@@ -18,7 +18,7 @@ public class ResellCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Override
public String getCommandStart() {
@@ -1,7 +1,7 @@
package me.wiefferink.areashop.commands;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.BuyRegion;
import me.wiefferink.areashop.regions.GeneralRegion;
import me.wiefferink.areashop.regions.RentRegion;
@@ -20,7 +20,7 @@ public class SchematiceventCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Override
public String getCommandStart() {
@@ -1,7 +1,7 @@
package me.wiefferink.areashop.commands;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.BuyRegion;
import me.wiefferink.areashop.regions.GeneralRegion;
import me.wiefferink.areashop.tools.Utils;
@@ -19,7 +19,7 @@ public class SellCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Override
public String getCommandStart() {
@@ -1,7 +1,7 @@
package me.wiefferink.areashop.commands;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.RentRegion;
import me.wiefferink.areashop.tools.Utils;
import org.bukkit.command.CommandSender;
@@ -19,7 +19,7 @@ public class SetdurationCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Inject
private Plugin plugin;
@@ -1,7 +1,7 @@
package me.wiefferink.areashop.commands;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.GeneralRegion;
import me.wiefferink.areashop.tools.Utils;
import org.bukkit.Bukkit;
@@ -20,7 +20,7 @@ public class SetlandlordCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Override
public String getCommandStart() {
@@ -1,7 +1,7 @@
package me.wiefferink.areashop.commands;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.BuyRegion;
import me.wiefferink.areashop.regions.GeneralRegion;
import me.wiefferink.areashop.regions.RentRegion;
@@ -24,7 +24,7 @@ public class SetownerCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Override
public String getCommandStart() {
@@ -1,7 +1,7 @@
package me.wiefferink.areashop.commands;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.BuyRegion;
import me.wiefferink.areashop.regions.GeneralRegion;
import me.wiefferink.areashop.regions.RentRegion;
@@ -20,7 +20,7 @@ public class SetpriceCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Override
public String getCommandStart() {
@@ -1,7 +1,7 @@
package me.wiefferink.areashop.commands;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.GeneralRegion;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin;
@@ -17,7 +17,7 @@ public class SetrestoreCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Inject
private Plugin plugin;
@@ -2,7 +2,7 @@ package me.wiefferink.areashop.commands;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.BuyRegion;
import me.wiefferink.areashop.regions.GeneralRegion;
import me.wiefferink.areashop.regions.RentRegion;
@@ -21,7 +21,7 @@ public class SetteleportCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Override
public String getCommandStart() {
@@ -8,7 +8,7 @@ import me.wiefferink.areashop.events.ask.AddingRegionEvent;
import me.wiefferink.areashop.interfaces.WorldEditInterface;
import me.wiefferink.areashop.interfaces.WorldEditSelection;
import me.wiefferink.areashop.interfaces.WorldGuardInterface;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.GeneralRegion;
import me.wiefferink.areashop.regions.RegionFactory;
import me.wiefferink.areashop.regions.RegionGroup;
@@ -33,7 +33,7 @@ public class StackCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Inject
private WorldEditInterface worldEditInterface;
@Inject
@@ -1,7 +1,7 @@
package me.wiefferink.areashop.commands;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.BuyRegion;
import me.wiefferink.areashop.tools.Utils;
import org.bukkit.command.CommandSender;
@@ -18,7 +18,7 @@ public class StopresellCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Override
public String getCommandStart() {
@@ -1,7 +1,7 @@
package me.wiefferink.areashop.commands;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.GeneralRegion;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -17,7 +17,7 @@ public class TeleportCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Override
public String getCommandStart() {
@@ -1,7 +1,7 @@
package me.wiefferink.areashop.commands;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.regions.GeneralRegion;
import me.wiefferink.areashop.regions.RentRegion;
import me.wiefferink.areashop.tools.Utils;
@@ -19,7 +19,7 @@ public class UnrentCommand extends CommandAreaShop {
@Inject
private MessageBridge messageBridge;
@Inject
private FileManager fileManager;
private IFileManager fileManager;
@Override
public String getCommandStart() {
@@ -177,7 +177,9 @@ public class RegionSign {
if(!Materials.isSign(block.getType())) {
Material signType = getMaterial();
if (!blockHelper.canPlace(block.getLocation(), Bukkit.createBlockData(signType))) {
AreaShop.warn("Setting sign", key, "of region", getRegion().getName(), "failed, could not set sign block back");
errorLogger.submitWarning("Setting sign" + key + "of region" + getRegion().getName() + "failed, could not set sign block back");
this.remove();
return false;
}
// Don't do physics here, we first need to update the direction
block.setType(signType, false);
@@ -190,7 +192,7 @@ public class RegionSign {
} else if(blockData instanceof org.bukkit.block.data.type.Sign) {
((org.bukkit.block.data.type.Sign) blockData).setRotation(getFacing());
} else {
AreaShop.warn("Failed to update the facing direction of the sign at", getStringLocation(), "to ", getFacing(), ", region:", getRegion().getName());
errorLogger.submitWarning("Failed to update the facing direction of the sign at" + getStringLocation() + "to " + getFacing() + ", region:" + getRegion().getName());
return false;
}
block.setBlockData(blockData);
@@ -9,7 +9,7 @@ import me.wiefferink.areashop.events.ask.AddingRegionEvent;
import me.wiefferink.areashop.events.notify.UpdateRegionEvent;
import me.wiefferink.areashop.interfaces.BukkitInterface;
import me.wiefferink.areashop.interfaces.WorldGuardInterface;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.managers.SignLinkerManager;
import me.wiefferink.areashop.nms.BlockBehaviourHelper;
import me.wiefferink.areashop.regions.BuyRegion;
@@ -50,7 +50,7 @@ public class SignListener implements Listener {
private final BukkitInterface bukkitInterface;
private final WorldGuardInterface worldGuardInterface;
private final RegionFactory regionFactory;
private final FileManager fileManager;
private final IFileManager fileManager;
public SignListener(
@Nonnull AreaShop plugin,
@@ -61,7 +61,7 @@ public class SignListener implements Listener {
@Nonnull BukkitInterface bukkitInterface,
@Nonnull WorldGuardInterface worldGuardInterface,
@Nonnull SignManager signManager,
@Nonnull FileManager fileManager) {
@Nonnull IFileManager fileManager) {
this.fileManager = fileManager;
this.signManager = signManager;
this.signLinkerManager = signLinkerManager;
@@ -252,14 +252,14 @@ public class SignListener implements Listener {
return;
}
FileManager.AddResult addResult = fileManager.checkRegionAdd(player, regionManager.getRegion(secondLine), event.getPlayer().getWorld(), GeneralRegion.RegionType.RENT);
if(addResult == FileManager.AddResult.BLACKLISTED) {
IFileManager.AddResult addResult = fileManager.checkRegionAdd(player, regionManager.getRegion(secondLine), event.getPlayer().getWorld(), GeneralRegion.RegionType.RENT);
if(addResult == IFileManager.AddResult.BLACKLISTED) {
messageBridge.message(player, "setup-blacklisted", secondLine);
} else if(addResult == FileManager.AddResult.ALREADYADDED) {
} else if(addResult == IFileManager.AddResult.ALREADYADDED) {
messageBridge.message(player, "setup-alreadyRentSign");
} else if(addResult == FileManager.AddResult.ALREADYADDEDOTHERWORLD) {
} else if(addResult == IFileManager.AddResult.ALREADYADDEDOTHERWORLD) {
messageBridge.message(player, "setup-alreadyOtherWorld");
} else if(addResult == FileManager.AddResult.NOPERMISSION) {
} else if(addResult == IFileManager.AddResult.NOPERMISSION) {
messageBridge.message(player, "setup-noPermission", secondLine);
} else if(thirdLine != null && !thirdLine.isEmpty() && !Utils.checkTimeFormat(thirdLine)) {
messageBridge.message(player, "setup-wrongDuration");
@@ -357,14 +357,14 @@ public class SignListener implements Listener {
messageBridge.message(player, "cmd-noRegion", secondLine);
return;
}
FileManager.AddResult addResult = plugin.getFileManager().checkRegionAdd(player, region, event.getPlayer().getWorld(), GeneralRegion.RegionType.BUY);
if(addResult == FileManager.AddResult.BLACKLISTED) {
IFileManager.AddResult addResult = plugin.getFileManager().checkRegionAdd(player, region, event.getPlayer().getWorld(), GeneralRegion.RegionType.BUY);
if(addResult == IFileManager.AddResult.BLACKLISTED) {
messageBridge.message(player, "setup-blacklisted", secondLine);
} else if(addResult == FileManager.AddResult.ALREADYADDED) {
} else if(addResult == IFileManager.AddResult.ALREADYADDED) {
messageBridge.message(player, "setup-alreadyRentSign");
} else if(addResult == FileManager.AddResult.ALREADYADDEDOTHERWORLD) {
} else if(addResult == IFileManager.AddResult.ALREADYADDEDOTHERWORLD) {
messageBridge.message(player, "setup-alreadyOtherWorld");
} else if(addResult == FileManager.AddResult.NOPERMISSION) {
} else if(addResult == IFileManager.AddResult.NOPERMISSION) {
messageBridge.message(player, "setup-noPermission", secondLine);
} else {
double price = 0.0;
@@ -8,7 +8,7 @@ import me.wiefferink.areashop.AreaShop;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.interfaces.BukkitInterface;
import me.wiefferink.areashop.interfaces.WorldGuardInterface;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.managers.SignLinkerManager;
import me.wiefferink.areashop.nms.BlockBehaviourHelper;
import me.wiefferink.areashop.regions.RegionFactory;
@@ -33,7 +33,7 @@ public class SignsModule extends AbstractModule {
@Nonnull BukkitInterface bukkitInterface,
@Nonnull WorldGuardInterface worldGuardInterface,
@Nonnull SignManager signManager,
@Nonnull FileManager fileManager
@Nonnull IFileManager fileManager
) {
final SignListener signListener = new SignListener(
plugin,
@@ -56,7 +56,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Singleton
public class FileManager extends Manager {
public class FileManager extends Manager implements IFileManager {
private final AreaShop plugin;
private final Map<String, GeneralRegion> regions;
@@ -81,25 +81,6 @@ public class FileManager extends Manager {
private final MessageBridge messageBridge;
private final RegionFactory regionFactory;
// Enum for region types
public enum AddResult {
BLACKLISTED("blacklisted"),
NOPERMISSION("nopermission"),
ALREADYADDED("alreadyadded"),
ALREADYADDEDOTHERWORLD("alreadyaddedotherworld"),
SUCCESS("success");
private final String value;
AddResult(String value) {
this.value = value;
}
public String getValue() {
return value;
}
}
/**
* Constructor, initialize variabeles.
*/
@@ -154,6 +135,7 @@ public class FileManager extends Manager {
* Get the folder where schematics are stored.
* @return The folder where schematics are stored
*/
@Override
public String getSchematicFolder() {
return schemFolder;
}
@@ -163,6 +145,7 @@ public class FileManager extends Manager {
* @param name The name of the group to get (will be normalized)
* @return The group if found, otherwise null
*/
@Override
public RegionGroup getGroup(String name) {
return groups.get(name.toLowerCase());
}
@@ -171,6 +154,7 @@ public class FileManager extends Manager {
* Get all groups.
* @return Collection with all groups (safe to modify)
*/
@Override
public Collection<RegionGroup> getGroups() {
return groups.values();
}
@@ -179,6 +163,7 @@ public class FileManager extends Manager {
* Get the default region settings as provided by the user (default.yml).
* @return YamlConfiguration with the settings (might miss settings, which should be filled in with {@link #getFallbackRegionSettings()})
*/
@Override
public YamlConfiguration getRegionSettings() {
return defaultConfig;
}
@@ -187,6 +172,7 @@ public class FileManager extends Manager {
* Get the default regions settings as provided by AreaShop (default.yml).
* @return YamlConfiguration with the default settings
*/
@Override
public YamlConfiguration getFallbackRegionSettings() {
return defaultConfigFallback;
}
@@ -195,6 +181,7 @@ public class FileManager extends Manager {
* Get the config file (config.yml).
* @return YamlConfiguration with the settings of users, with fallback to the settings provided by AreaShop
*/
@Override
public YamlConfiguration getConfig() {
return config;
}
@@ -204,6 +191,7 @@ public class FileManager extends Manager {
* @param name The name of the region to get (will be normalized)
* @return The region if found, otherwise null
*/
@Override
public @Nullable GeneralRegion getRegion(String name) {
return regions.get(name.toLowerCase());
}
@@ -213,6 +201,7 @@ public class FileManager extends Manager {
* @param name The name of the rental region (will be normalized)
* @return RentRegion if it could be found, otherwise null
*/
@Override
public @Nullable RentRegion getRent(String name) {
return rents.get(name.toLowerCase(Locale.ENGLISH));
}
@@ -222,6 +211,7 @@ public class FileManager extends Manager {
* @param name The name of the buy region (will be normalized)
* @return BuyRegion if it could be found, otherwise null
*/
@Override
public @Nullable BuyRegion getBuy(String name) {
return buys.get(name.toLowerCase(Locale.ENGLISH));
}
@@ -230,6 +220,7 @@ public class FileManager extends Manager {
* Get all rental regions.
* @return List of all rental regions
*/
@Override
public Collection<RentRegion> getRents() {
return new ArrayList<>(rents.values());
}
@@ -238,6 +229,7 @@ public class FileManager extends Manager {
* Get all rental regions.
* @return List of all rental regions
*/
@Override
public Collection<RentRegion> getRentsRef() {
return Collections.unmodifiableCollection(rents.values());
}
@@ -246,10 +238,12 @@ public class FileManager extends Manager {
* Get all buy regions.
* @return List of all buy regions
*/
@Override
public List<BuyRegion> getBuys() {
return new ArrayList<>(buys.values());
}
@Override
public Collection<BuyRegion> getBuysRef() {
return Collections.unmodifiableCollection(buys.values());
}
@@ -259,6 +253,7 @@ public class FileManager extends Manager {
* Get all regions.
* @return List of all regions (it is safe to modify the list)
*/
@Override
public List<GeneralRegion> getRegions() {
return new ArrayList<>(regions.values());
}
@@ -267,6 +262,7 @@ public class FileManager extends Manager {
* Get all regions.
* @return List of all regions (it is safe to modify the list)
*/
@Override
public Collection<GeneralRegion> getRegionsRef() {
return Collections.unmodifiableCollection(regions.values());
}
@@ -275,6 +271,7 @@ public class FileManager extends Manager {
* Get a list of names of all buy regions.
* @return A String list with all the names
*/
@Override
public List<String> getBuyNames() {
ArrayList<String> result = new ArrayList<>(buys.size());
for(BuyRegion region : buys.values()) {
@@ -287,6 +284,7 @@ public class FileManager extends Manager {
* Get a list of names of all rent regions.
* @return A String list with all the names
*/
@Override
public List<String> getRentNames() {
ArrayList<String> result = new ArrayList<>(rents.size());
for(RentRegion region : rents.values()) {
@@ -299,6 +297,7 @@ public class FileManager extends Manager {
* Get a list of names of all regions.
* @return A String list with all the names
*/
@Override
public List<String> getRegionNames() {
ArrayList<String> result = new ArrayList<>(regions.size());
for(GeneralRegion region : regions.values()) {
@@ -311,6 +310,7 @@ public class FileManager extends Manager {
* Get a list of names of all groups.
* @return A String list with all the names
*/
@Override
public List<String> getGroupNames() {
ArrayList<String> result = new ArrayList<>();
for(RegionGroup group : groups.values()) {
@@ -324,6 +324,7 @@ public class FileManager extends Manager {
* @param region Then region to add
* @return true when successful, otherwise false (denied by an event listener)
*/
@Override
public AddingRegionEvent addRegion(GeneralRegion region) {
AddingRegionEvent event = addRegionNoSave(region);
if (event.isCancelled()) {
@@ -339,6 +340,7 @@ public class FileManager extends Manager {
* @param region The region to add
* @return true when successful, otherwise false (denied by an event listener)
*/
@Override
public AddingRegionEvent addRegionNoSave(GeneralRegion region) {
AddingRegionEvent event = new AddingRegionEvent(region);
if(region == null) {
@@ -364,6 +366,7 @@ public class FileManager extends Manager {
/**
* Mark all RegionGroups that they should regenerate regions.
*/
@Override
public void markGroupsAutoDirty() {
for(RegionGroup group : getGroups()) {
group.autoDirty();
@@ -374,6 +377,7 @@ public class FileManager extends Manager {
* Add a RegionGroup.
* @param group The RegionGroup to add
*/
@Override
public void addGroup(RegionGroup group) {
groups.put(group.getName().toLowerCase(), group);
String lowGroup = group.getName().toLowerCase();
@@ -390,7 +394,11 @@ public class FileManager extends Manager {
* @param type The type the region should have in AreaShop
* @return The result if a player would want to add this region
*/
public AddResult checkRegionAdd(CommandSender sender, ProtectedRegion region, World world, RegionType type) {
@Override
public AddResult checkRegionAdd(CommandSender sender,
ProtectedRegion region,
World world,
RegionType type) {
Player player = null;
if(sender instanceof Player) {
player = (Player)sender;
@@ -432,6 +440,7 @@ public class FileManager extends Manager {
* @param giveMoneyBack use true to give money back to the player if someone is currently holding this region, otherwise false
* @return true if the region has been removed, false otherwise
*/
@Override
public DeletingRegionEvent deleteRegion(GeneralRegion region, boolean giveMoneyBack) {
DeletingRegionEvent event = new DeletingRegionEvent(region);
if(region == null) {
@@ -496,6 +505,7 @@ public class FileManager extends Manager {
* Remove a group.
* @param group Group to remove
*/
@Override
public void removeGroup(RegionGroup group) {
groups.remove(group.getLowerCaseName());
groupsConfig.set(group.getLowerCaseName(), null);
@@ -505,6 +515,7 @@ public class FileManager extends Manager {
/**
* Update all signs that need periodic updating.
*/
@Override
public void performPeriodicSignUpdate() {
Do.forAll(
plugin.getConfig().getInt("signs.regionsPerTick"),
@@ -520,6 +531,7 @@ public class FileManager extends Manager {
/**
* Send out rent expire warnings.
*/
@Override
public void sendRentExpireWarnings() {
Do.forAll(
plugin.getConfig().getInt("expireWarning.regionsPerTick"),
@@ -533,7 +545,9 @@ public class FileManager extends Manager {
* @param regions Regions to update
* @param confirmationReceiver The CommandSender that should be notified at completion
*/
public void updateRegions(final Collection<GeneralRegion> regions, final CommandSender confirmationReceiver) {
@Override
public void updateRegions(final Collection<GeneralRegion> regions,
final CommandSender confirmationReceiver) {
final int regionsPerTick = plugin.getConfig().getInt("update.regionsPerTick");
if(confirmationReceiver != null) {
messageBridge.message(confirmationReceiver, "reload-updateStart", regions.size(), regionsPerTick * 20);
@@ -554,6 +568,7 @@ public class FileManager extends Manager {
* Update a list of regions.
* @param regions The list of regions to update.
*/
@Override
public void updateRegions(Collection<GeneralRegion> regions) {
updateRegions(regions, null);
}
@@ -561,6 +576,7 @@ public class FileManager extends Manager {
/**
* Update all regions, happens in a task to minimize lag.
*/
@Override
public void updateAllRegions() {
updateRegions(getRegionsRef(), null);
}
@@ -569,6 +585,7 @@ public class FileManager extends Manager {
* Update all regions.
* @param confirmationReceiver Optional CommandSender that should receive progress messages
*/
@Override
public void updateAllRegions(CommandSender confirmationReceiver) {
updateRegions(getRegionsRef(), confirmationReceiver);
}
@@ -577,6 +594,7 @@ public class FileManager extends Manager {
/**
* Save the group file to disk.
*/
@Override
public void saveGroupsIsRequired() {
saveGroupsRequired = true;
}
@@ -585,6 +603,7 @@ public class FileManager extends Manager {
* Check if saving the groups file is required.
* @return true if changes are made and saving is required, otherwise false
*/
@Override
public boolean isSaveGroupsRequired() {
return saveGroupsRequired;
}
@@ -592,6 +611,7 @@ public class FileManager extends Manager {
/**
* Save the groups file to disk synchronously.
*/
@Override
public void saveGroupsNow() {
AreaShop.debug("saveGroupsNow() done");
saveGroupsRequired = false;
@@ -606,6 +626,7 @@ public class FileManager extends Manager {
/**
* Save all region related files spread over time (low load).
*/
@Override
public void saveRequiredFiles() {
if(isSaveGroupsRequired()) {
saveGroupsNow();
@@ -626,6 +647,7 @@ public class FileManager extends Manager {
/**
* Save all region related files directly (only for cases like onDisable()).
*/
@Override
public void saveRequiredFilesAtOnce() {
if(isSaveGroupsRequired()) {
saveGroupsNow();
@@ -642,6 +664,7 @@ public class FileManager extends Manager {
* Indicates that a/multiple WorldGuard regions need to be saved.
* @param worldName The world where the regions that should be saved is in
*/
@Override
public void saveIsRequiredForRegionWorld(String worldName) {
worldRegionsRequireSaving.add(worldName);
}
@@ -649,6 +672,7 @@ public class FileManager extends Manager {
/**
* Save all worldGuard regions that need saving.
*/
@Override
public void saveWorldGuardRegions() {
for(String world : worldRegionsRequireSaving) {
World bukkitWorld = Bukkit.getWorld(world);
@@ -669,6 +693,7 @@ public class FileManager extends Manager {
* Get the folder the region files are located in.
* @return The folder where the region.yml files are in
*/
@Override
public String getRegionFolder() {
return regionsPath;
}
@@ -678,6 +703,7 @@ public class FileManager extends Manager {
* @param region The region name to check
* @return true if the region may not be added, otherwise false
*/
@Override
public boolean isBlacklisted(String region) {
for(String line : plugin.getConfig().getStringList("blacklist")) {
Pattern pattern = Pattern.compile(line, Pattern.CASE_INSENSITIVE);
@@ -692,6 +718,7 @@ public class FileManager extends Manager {
/**
* Unrent regions that have no time left, regions to check per tick is in the config.
*/
@Override
public void checkRents() {
Do.forAll(
plugin.getConfig().getInt("expiration.regionsPerTick"),
@@ -703,6 +730,7 @@ public class FileManager extends Manager {
/**
* Check all regions and unrent/sell them if the player is inactive for too long.
*/
@Override
public void checkForInactiveRegions() {
Do.forAll(
plugin.getConfig().getInt("inactive.regionsPerTick"),
@@ -715,6 +743,7 @@ public class FileManager extends Manager {
/**
* Load the file with the versions, used to check if the other files need conversion.
*/
@Override
@SuppressWarnings("unchecked")
public void loadVersions() {
File file = new File(versionPath);
@@ -737,6 +766,7 @@ public class FileManager extends Manager {
/**
* Save the versions file to disk.
*/
@Override
public void saveVersions() {
if(!(new File(versionPath).exists())) {
AreaShop.debug("versions file created, this should happen only after installing or upgrading the plugin");
@@ -753,6 +783,7 @@ public class FileManager extends Manager {
* @param thisTick Load files in the current tick or a tick later
* @return true if the files are loaded correctly, otherwise false
*/
@Override
public boolean loadFiles(boolean thisTick) {
// Load config.yml + add defaults from .jar
boolean result = loadConfigFile();
@@ -784,6 +815,7 @@ public class FileManager extends Manager {
* Load the default.yml file
* @return true if it has been loaded successfully, otherwise false
*/
@Override
public boolean loadDefaultFile() {
boolean result = true;
File defaultFile = new File(defaultPath);
@@ -824,6 +856,7 @@ public class FileManager extends Manager {
* Load the default.yml file
* @return true if it has been loaded successfully, otherwise false
*/
@Override
public boolean loadConfigFile() {
boolean result = true;
File configFile = new File(configPath);
@@ -878,6 +911,7 @@ public class FileManager extends Manager {
* Load the groups.yml file from disk
* @return true if succeeded, otherwise false
*/
@Override
public boolean loadGroupsFile() {
boolean result = true;
File groupFile = new File(groupsPath);
@@ -903,6 +937,7 @@ public class FileManager extends Manager {
/**
* Load all region files.
*/
@Override
public void loadRegionFiles() {
regions.clear();
final File file = new File(regionsPath);
@@ -928,7 +963,7 @@ public class FileManager extends Manager {
List<String> noRegionType = new ArrayList<>();
List<String> noNamePaths = new ArrayList<>();
List<GeneralRegion> noWorld = new ArrayList<>();
List<GeneralRegion> noRegion = new ArrayList<>();
Map<GeneralRegion, File> noRegion = new HashMap<>();
List<GeneralRegion> incorrectDuration = new ArrayList<>();
for(File regionFile : regionFiles) {
if(regionFile.exists() && regionFile.isFile() && !regionFile.isHidden()) {
@@ -941,6 +976,8 @@ public class FileManager extends Manager {
regionConfig = YamlConfiguration.loadConfiguration(reader);
if(regionConfig.getKeys(false).isEmpty()) {
AreaShop.warn("Region file '" + regionFile.getName() + "' is empty, check for errors in the log.");
regionFile.delete();
continue;
}
} catch(IOException e) {
AreaShop.warn("Something went wrong reading region file: " + regionFile.getAbsolutePath());
@@ -966,7 +1003,7 @@ public class FileManager extends Manager {
} else if(region.getWorld() == null) {
noWorld.add(region);
} else if(region.getRegion() == null) {
noRegion.add(region);
noRegion.put(region, regionFile);
} else if(region instanceof RentRegion && !Utils.checkTimeFormat(((RentRegion)region).getDurationString())) {
incorrectDuration.add(region);
} else {
@@ -990,11 +1027,11 @@ public class FileManager extends Manager {
if(!noRegion.isEmpty()) {
List<String> noRegionNames = new ArrayList<>();
for(GeneralRegion region : noRegion) {
noRegionNames.add(region.getName());
for(Map.Entry<GeneralRegion, File> regionMap : noRegion.entrySet()) {
noRegionNames.add(regionMap.getKey().getName());
regionMap.getValue().delete();
}
AreaShop.warn("AreaShop regions that are missing their WorldGuard region: " + Utils.createCommaSeparatedList(noRegionNames));
AreaShop.warn("Remove these regions from AreaShop with '/as del' or recreate their regions in WorldGuard.");
AreaShop.warn("AreaShop regions that are missing their WorldGuard region are now being deleted: " + Utils.createCommaSeparatedList(noRegionNames));
}
boolean noWorldRegions = !noWorld.isEmpty();
@@ -1345,6 +1382,7 @@ public class FileManager extends Manager {
* @param groupName Name of the group to get the settings from
* @return The settings of the group
*/
@Override
public ConfigurationSection getGroupSettings(String groupName) {
return groupsConfig.getConfigurationSection(groupName.toLowerCase());
}
@@ -1355,6 +1393,7 @@ public class FileManager extends Manager {
* @param path The path to set
* @param setting The value to set
*/
@Override
public void setGroupSetting(RegionGroup group, String path, Object setting) {
groupsConfig.set(group.getName().toLowerCase() + "." + path, setting);
}
@@ -0,0 +1,395 @@
package me.wiefferink.areashop.managers;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import me.wiefferink.areashop.events.ask.AddingRegionEvent;
import me.wiefferink.areashop.events.ask.DeletingRegionEvent;
import me.wiefferink.areashop.regions.BuyRegion;
import me.wiefferink.areashop.regions.GeneralRegion;
import me.wiefferink.areashop.regions.RegionGroup;
import me.wiefferink.areashop.regions.RentRegion;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.List;
public interface IFileManager {
/**
* Get the folder where schematics are stored.
*
* @return The folder where schematics are stored
*/
String getSchematicFolder();
/**
* Get a group.
*
* @param name The name of the group to get (will be normalized)
* @return The group if found, otherwise null
*/
RegionGroup getGroup(String name);
/**
* Get all groups.
*
* @return Collection with all groups (safe to modify)
*/
Collection<RegionGroup> getGroups();
/**
* Get the default region settings as provided by the user (default.yml).
*
* @return YamlConfiguration with the settings (might miss settings, which should be filled in with {@link #getFallbackRegionSettings()})
*/
YamlConfiguration getRegionSettings();
/**
* Get the default regions settings as provided by AreaShop (default.yml).
*
* @return YamlConfiguration with the default settings
*/
YamlConfiguration getFallbackRegionSettings();
/**
* Get the config file (config.yml).
*
* @return YamlConfiguration with the settings of users, with fallback to the settings provided by AreaShop
*/
YamlConfiguration getConfig();
/**
* Get a region.
*
* @param name The name of the region to get (will be normalized)
* @return The region if found, otherwise null
*/
@Nullable
GeneralRegion getRegion(String name);
/**
* Get a rental region.
*
* @param name The name of the rental region (will be normalized)
* @return RentRegion if it could be found, otherwise null
*/
@Nullable
RentRegion getRent(String name);
/**
* Get a buy region.
*
* @param name The name of the buy region (will be normalized)
* @return BuyRegion if it could be found, otherwise null
*/
@Nullable
BuyRegion getBuy(String name);
/**
* Get all rental regions.
*
* @return List of all rental regions
*/
Collection<RentRegion> getRents();
/**
* Get all rental regions.
*
* @return List of all rental regions
*/
Collection<RentRegion> getRentsRef();
/**
* Get all buy regions.
*
* @return List of all buy regions
*/
List<BuyRegion> getBuys();
Collection<BuyRegion> getBuysRef();
/**
* Get all regions.
*
* @return List of all regions (it is safe to modify the list)
*/
List<GeneralRegion> getRegions();
/**
* Get all regions.
*
* @return List of all regions (it is safe to modify the list)
*/
Collection<GeneralRegion> getRegionsRef();
/**
* Get a list of names of all buy regions.
*
* @return A String list with all the names
*/
List<String> getBuyNames();
/**
* Get a list of names of all rent regions.
*
* @return A String list with all the names
*/
List<String> getRentNames();
/**
* Get a list of names of all regions.
*
* @return A String list with all the names
*/
List<String> getRegionNames();
/**
* Get a list of names of all groups.
*
* @return A String list with all the names
*/
List<String> getGroupNames();
/**
* Add a region to the list and mark it as to-be-saved.
*
* @param region Then region to add
* @return true when successful, otherwise false (denied by an event listener)
*/
AddingRegionEvent addRegion(GeneralRegion region);
/**
* Add a region to the list without saving it to disk (useful for loading at startup).
*
* @param region The region to add
* @return true when successful, otherwise false (denied by an event listener)
*/
AddingRegionEvent addRegionNoSave(GeneralRegion region);
/**
* Mark all RegionGroups that they should regenerate regions.
*/
void markGroupsAutoDirty();
/**
* Add a RegionGroup.
*
* @param group The RegionGroup to add
*/
void addGroup(RegionGroup group);
/**
* Check if a player can add a certain region as rent or buy region.
*
* @param sender The player/console that wants to add a region
* @param region The WorldGuard region to add
* @param world The world the ProtectedRegion is located in
* @param type The type the region should have in AreaShop
* @return The result if a player would want to add this region
*/
AddResult checkRegionAdd(CommandSender sender,
ProtectedRegion region,
World world,
GeneralRegion.RegionType type);
/**
* Remove a region from the list.
*
* @param region The region to remove
* @param giveMoneyBack use true to give money back to the player if someone is currently holding this region, otherwise false
* @return true if the region has been removed, false otherwise
*/
DeletingRegionEvent deleteRegion(GeneralRegion region, boolean giveMoneyBack);
/**
* Remove a group.
*
* @param group Group to remove
*/
void removeGroup(RegionGroup group);
/**
* Update all signs that need periodic updating.
*/
void performPeriodicSignUpdate();
/**
* Send out rent expire warnings.
*/
void sendRentExpireWarnings();
/**
* Update regions in a task to minimize lag.
*
* @param regions Regions to update
* @param confirmationReceiver The CommandSender that should be notified at completion
*/
void updateRegions(Collection<GeneralRegion> regions, CommandSender confirmationReceiver);
/**
* Update a list of regions.
*
* @param regions The list of regions to update.
*/
void updateRegions(Collection<GeneralRegion> regions);
/**
* Update all regions, happens in a task to minimize lag.
*/
void updateAllRegions();
/**
* Update all regions.
*
* @param confirmationReceiver Optional CommandSender that should receive progress messages
*/
void updateAllRegions(CommandSender confirmationReceiver);
/**
* Save the group file to disk.
*/
void saveGroupsIsRequired();
/**
* Check if saving the groups file is required.
*
* @return true if changes are made and saving is required, otherwise false
*/
boolean isSaveGroupsRequired();
/**
* Save the groups file to disk synchronously.
*/
void saveGroupsNow();
/**
* Save all region related files spread over time (low load).
*/
void saveRequiredFiles();
/**
* Save all region related files directly (only for cases like onDisable()).
*/
void saveRequiredFilesAtOnce();
/**
* Indicates that a/multiple WorldGuard regions need to be saved.
*
* @param worldName The world where the regions that should be saved is in
*/
void saveIsRequiredForRegionWorld(String worldName);
/**
* Save all worldGuard regions that need saving.
*/
void saveWorldGuardRegions();
/**
* Get the folder the region files are located in.
*
* @return The folder where the region.yml files are in
*/
String getRegionFolder();
/**
* Check if a region is on the adding blacklist.
*
* @param region The region name to check
* @return true if the region may not be added, otherwise false
*/
boolean isBlacklisted(String region);
/**
* Unrent regions that have no time left, regions to check per tick is in the config.
*/
void checkRents();
/**
* Check all regions and unrent/sell them if the player is inactive for too long.
*/
void checkForInactiveRegions();
/**
* Load the file with the versions, used to check if the other files need conversion.
*/
@SuppressWarnings("unchecked")
void loadVersions();
/**
* Save the versions file to disk.
*/
void saveVersions();
/**
* Load all files from disk.
*
* @param thisTick Load files in the current tick or a tick later
* @return true if the files are loaded correctly, otherwise false
*/
boolean loadFiles(boolean thisTick);
/**
* Load the default.yml file
*
* @return true if it has been loaded successfully, otherwise false
*/
boolean loadDefaultFile();
/**
* Load the default.yml file
*
* @return true if it has been loaded successfully, otherwise false
*/
boolean loadConfigFile();
/**
* Load the groups.yml file from disk
*
* @return true if succeeded, otherwise false
*/
boolean loadGroupsFile();
/**
* Load all region files.
*/
void loadRegionFiles();
/**
* Get the settings of a group.
*
* @param groupName Name of the group to get the settings from
* @return The settings of the group
*/
ConfigurationSection getGroupSettings(String groupName);
/**
* Set a setting for a group.
*
* @param group The group to set it for
* @param path The path to set
* @param setting The value to set
*/
void setGroupSetting(RegionGroup group, String path, Object setting);
// Enum for region types
public enum AddResult {
BLACKLISTED("blacklisted"),
NOPERMISSION("nopermission"),
ALREADYADDED("alreadyadded"),
ALREADYADDEDOTHERWORLD("alreadyaddedotherworld"),
SUCCESS("success");
private final String value;
AddResult(String value) {
this.value = value;
}
public String getValue() {
return value;
}
}
}
@@ -12,6 +12,7 @@ import me.wiefferink.areashop.interfaces.WorldEditInterface;
import me.wiefferink.areashop.interfaces.WorldGuardInterface;
import me.wiefferink.areashop.managers.CommandManager;
import me.wiefferink.areashop.managers.FeatureManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.SignErrorLogger;
import me.wiefferink.areashop.managers.SignLinkerManager;
@@ -67,7 +68,7 @@ public class AreaShopModule extends AbstractModule {
bind(WorldEditInterface.class).toInstance(this.worldEditInterface);
bind(SignErrorLogger.class).toInstance(this.signErrorLogger);
// Setup managers
bind(FileManager.class).asEagerSingleton();
bind(IFileManager.class).to(FileManager.class).asEagerSingleton();
bind(FeatureManager.class).in(Singleton.class);
bind(CommandManager.class).in(Singleton.class);
bind(SignLinkerManager.class).in(Singleton.class);
@@ -13,7 +13,7 @@ import me.wiefferink.areashop.interfaces.GeneralRegionInterface;
import me.wiefferink.areashop.interfaces.WorldEditInterface;
import me.wiefferink.areashop.interfaces.WorldGuardInterface;
import me.wiefferink.areashop.managers.FeatureManager;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import me.wiefferink.areashop.tools.Utils;
import me.wiefferink.bukkitdo.Do;
import me.wiefferink.interactivemessenger.processing.Message;
@@ -415,7 +415,7 @@ public abstract class GeneralRegion implements GeneralRegionInterface, Comparabl
* Get the FileManager from the plugin.
* @return The FileManager (responsible for saving/loading regions and getting them)
*/
public FileManager getFileManager() {
public IFileManager getFileManager() {
return plugin.getFileManager();
}
@@ -11,7 +11,7 @@ import me.wiefferink.areashop.events.ask.AddingRegionEvent;
import me.wiefferink.areashop.features.signs.RegionSign;
import me.wiefferink.areashop.features.signs.SignManager;
import me.wiefferink.areashop.interfaces.WorldGuardInterface;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
@@ -34,7 +34,7 @@ import java.util.UUID;
public class ImportJob {
private final AreaShop plugin;
private final FileManager fileManager;
private final IFileManager fileManager;
private final SignManager signManager;
private final WorldGuardInterface worldGuardInterface;
private final CommandSender sender;
@@ -48,7 +48,7 @@ public class ImportJob {
@AssistedInject
ImportJob(
@Nonnull AreaShop plugin,
@Nonnull FileManager fileManager,
@Nonnull IFileManager fileManager,
@Nonnull SignManager signManager,
@Nonnull WorldGuardInterface worldGuardInterface,
@Nonnull MessageBridge messageBridge,
@@ -2,7 +2,7 @@ package me.wiefferink.areashop.regions;
import com.google.inject.assistedinject.Assisted;
import com.google.inject.assistedinject.AssistedInject;
import me.wiefferink.areashop.managers.FileManager;
import me.wiefferink.areashop.managers.IFileManager;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
@@ -16,7 +16,7 @@ import java.util.Set;
public class RegionGroup {
private final Plugin plugin;
private final FileManager fileManager;
private final IFileManager fileManager;
private final String name;
private final Set<String> regions;
private Set<String> autoRegions;
@@ -29,7 +29,7 @@ public class RegionGroup {
* @param name Name of the group, has to be unique
*/
@AssistedInject
RegionGroup(@Nonnull Plugin plugin, @Nonnull FileManager fileManager, @Assisted String name) {
RegionGroup(@Nonnull Plugin plugin, @Nonnull IFileManager fileManager, @Assisted String name) {
this.plugin = plugin;
this.fileManager = fileManager;
this.name = name;
+25
View File
@@ -4,3 +4,28 @@ dependencies {
}
description = 'AreaShop Bukkit 1.13 and higher'
publishing {
publications {
// ... artifact publications
areaShop(MavenPublication) {
from components.java
pom {
group = "me.wiefferink"
artifactId = "$project.name"
version = "$project.version"
scm {
connection = 'scm:git:git://github.com/md5sha256/AreaShop.git'
developerConnection = 'scm:git:ssh://github.com/md5sha256/AreaShop.git'
url = "https://github.com/md5sha256/AreaShop/tree/dev/bleeding"
}
licenses {
license {
name = 'GNU General Public License v3.0'
url = "https://github.com/md5sha256/AreaShop/blob/dev/bleeding/LICENSE"
}
}
}
}
}
}
+28 -3
View File
@@ -1,7 +1,32 @@
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
compileOnly 'com.sk89q.worldedit:worldedit-bukkit:7.2.5'
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.5'
compileOnly 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT'
compileOnly 'com.sk89q.worldedit:worldedit-bukkit:7.2.8'
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.6'
}
description = 'AreaShop Interface'
publishing {
publications {
// ... artifact publications
areaShop(MavenPublication) {
from components.java
pom {
group = "me.wiefferink"
artifactId = "$project.name"
version = "$project.version"
scm {
connection = 'scm:git:git://github.com/md5sha256/AreaShop.git'
developerConnection = 'scm:git:ssh://github.com/md5sha256/AreaShop.git'
url = "https://github.com/md5sha256/AreaShop/tree/dev/bleeding"
}
licenses {
license {
name = 'GNU General Public License v3.0'
url = "https://github.com/md5sha256/AreaShop/blob/dev/bleeding/LICENSE"
}
}
}
}
}
}
+15 -14
View File
@@ -1,13 +1,18 @@
plugins {
id 'java'
id 'java-library'
id 'maven-publish'
id 'io.papermc.paperweight.userdev' version '1.3.3' apply false
}
group = 'me.wiefferink.areashop'
version = '2.7.0-SNAPSHOT'
group = 'me.wiefferink'
version = '2.7.2'
subprojects {
plugins.apply('java')
plugins.apply('java-library')
plugins.apply('maven-publish')
version = '2.7.1'
repositories {
mavenCentral()
@@ -41,14 +46,10 @@ subprojects {
}
tasks.withType(JavaCompile) {
tasks.withType(JavaCompile) {
javaToolchains.compilerFor {
JavaLanguageVersion.of(16)
}
options.release.set(16)
options.encoding = 'UTF-8'
options.fork = true
options.deprecation = true
}
java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))
options.release.set(17)
options.encoding = 'UTF-8'
options.fork = true
options.deprecation = true
}
}
}
+1
View File
@@ -0,0 +1 @@
org.gradle.parallel=true
+1 -1
View File
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
+33 -5
View File
@@ -1,15 +1,43 @@
repositories {
maven {
name = 'IS-Repo'
url = uri('https://mvn.intellectualsites.com/content/repositories/releases/')
name = "S01 Sonatype Snapshots"
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
}
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
compileOnly 'com.fastasyncworldedit:FAWE-Bukkit:1.17-268'
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.5'
compileOnly 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT'
compileOnly("com.fastasyncworldedit:FastAsyncWorldEdit-Core:2.0.0-SNAPSHOT")
compileOnly("com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit:2.0.0-SNAPSHOT") {
}
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.6'
compileOnly project(':areashop-interface')
}
description = 'AreaShop FastAsyncWorldEdit'
publishing {
publications {
// ... artifact publications
areaShop(MavenPublication) {
from components.java
pom {
group = "me.wiefferink"
artifactId = "$project.name"
version = "$project.version"
scm {
connection = 'scm:git:git://github.com/md5sha256/AreaShop.git'
developerConnection = 'scm:git:ssh://github.com/md5sha256/AreaShop.git'
url = "https://github.com/md5sha256/AreaShop/tree/dev/bleeding"
}
licenses {
license {
name = 'GNU General Public License v3.0'
url = "https://github.com/md5sha256/AreaShop/blob/dev/bleeding/LICENSE"
}
}
}
}
}
}
@@ -1,16 +1,17 @@
package me.wiefferink.areashop.handlers;
import com.fastasyncworldedit.core.FaweAPI;
import com.fastasyncworldedit.core.extent.clipboard.MemoryOptimizedClipboard;
import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicReader;
import com.fastasyncworldedit.core.extent.processor.lighting.RelightMode;
import com.fastasyncworldedit.core.object.FaweLimit;
import com.fastasyncworldedit.core.util.EditSessionBuilder;
import com.fastasyncworldedit.core.limit.FaweLimit;
import com.google.common.annotations.Beta;
import com.sk89q.jnbt.NBTInputStream;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.*;
@@ -31,6 +32,7 @@ import me.wiefferink.areashop.interfaces.AreaShopInterface;
import me.wiefferink.areashop.interfaces.GeneralRegionInterface;
import me.wiefferink.areashop.interfaces.WorldEditInterface;
import me.wiefferink.areashop.interfaces.WorldEditSelection;
import net.kyori.adventure.nbt.TagStringIO;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.bukkit.entity.Player;
import org.bukkit.util.BoundingBox;
@@ -115,7 +117,11 @@ public class FastAsyncWorldEditHandler extends WorldEditInterface {
final CompletableFuture<Boolean> completableFuture = new CompletableFuture<>();
final FaweLimit limit = new FaweLimit();
limit.MAX_CHANGES = pluginInterface.getConfig().getInt("maximumBlocks");
EditSession editSession = new EditSessionBuilder(world).limit(limit).relightMode(RelightMode.OPTIMAL).build();
EditSession editSession = WorldEdit.getInstance().newEditSessionBuilder()
.world(world)
.limit(limit)
.relightMode(RelightMode.OPTIMAL)
.build();
editSession.setReorderMode(EditSession.ReorderMode.MULTI_STAGE);
ProtectedRegion region = regionInterface.getRegion();
final RegionType regionType = region.getType();
@@ -152,7 +158,7 @@ public class FastAsyncWorldEditHandler extends WorldEditInterface {
}
clipboard.setOrigin(clipboard.getMinimumPoint());
ClipboardHolder clipboardHolder = new ClipboardHolder(clipboard);
session.setBlockChangeLimit(limit.MAX_CHANGES);
session.setBlockChangeLimit((int) limit.MAX_CHANGES);
session.setClipboard(clipboardHolder);
// Build operation
@@ -219,7 +225,11 @@ public class FastAsyncWorldEditHandler extends WorldEditInterface {
}
final FaweLimit limit = new FaweLimit();
limit.MAX_CHANGES = pluginInterface.getConfig().getInt("maximumBlocks");
EditSession editSession = new EditSessionBuilder(world).relightMode(RelightMode.OPTIMAL).limit(limit).build();
EditSession editSession = WorldEdit.getInstance().newEditSessionBuilder()
.world(world)
.relightMode(RelightMode.OPTIMAL)
.limit(limit)
.build();
final ProtectedRegion region = regionInterface.getRegion();
final BlockVector3 min = region.getMinimumPoint(), max = region.getMaximumPoint();
+33 -4
View File
@@ -1,12 +1,41 @@
repositories {
mavenLocal()
}
plugins.apply("io.papermc.paperweight.userdev")
dependencies {
compileOnly 'org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT'
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.17.1-R0.1-SNAPSHOT")
compileOnly project(':areashop-interface')
compileOnly project(':areashop-nms')
}
reobfJar {
outputJar.set(file("build/libs/${project.name}-${project.version}.jar"))
}
assemble {
dependsOn(reobfJar)
}
publishing {
publications {
// ... artifact publications
nmsProvider(MavenPublication) {
pom {
group = "me.wiefferink"
artifactId = "$project.name"
version = "$project.version"
scm {
connection = 'scm:git:git://github.com/md5sha256/AreaShop.git'
developerConnection = 'scm:git:ssh://github.com/md5sha256/AreaShop.git'
url = "https://github.com/md5sha256/AreaShop/tree/dev/bleeding"
}
licenses {
license {
name = 'GNU General Public License v3.0'
url = "https://github.com/md5sha256/AreaShop/blob/dev/bleeding/LICENSE"
}
}
}
}
}
}
description = 'AreaShop NMS Helper'
@@ -1,12 +1,11 @@
package me.wiefferink.areashop.nms.v1_17_R1;
import me.wiefferink.areashop.nms.BlockBehaviourHelper;
import net.minecraft.core.BlockPosition;
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.block.state.BlockState;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_17_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_17_R1.block.CraftBlock;
@@ -20,28 +19,28 @@ public class BlockBehaviourImpl implements BlockBehaviourHelper {
@Override
public boolean canPlace(Location location, BlockData blockData) {
Objects.requireNonNull(location.getWorld(), "Null World!");
final BlockPosition blockPosition = new BlockPosition(location.getX(), location.getY(), location.getZ());
final BlockPos blockPos = new BlockPos(location.getX(), location.getY(), location.getZ());
final CraftWorld craftWorld = (CraftWorld) location.getWorld();
final World world = craftWorld.getHandle();
final ServerLevel world = craftWorld.getHandle();
final CraftBlockData craftBlockData = (CraftBlockData) blockData;
final IBlockData ibd = craftBlockData.getState();
return ibd.canPlace(world, blockPosition);
final BlockState ibd = craftBlockData.getState();
return ibd.canSurvive(world, blockPos);
}
@Override
public boolean isBlockValid(Block block) {
final CraftBlock craftBlock = (CraftBlock) block;
final CraftWorld craftWorld = (CraftWorld) craftBlock.getWorld();
final World world = craftWorld.getHandle();
final IBlockData ibd = craftBlock.getNMS();
return ibd.canPlace(world, craftBlock.getPosition());
final ServerLevel world = craftWorld.getHandle();
final BlockState ibd = craftBlock.getNMS();
return ibd.canSurvive(world, craftBlock.getPosition());
}
@Override
public boolean isBlockStateValid(BlockState blockState) {
public boolean isBlockStateValid(org.bukkit.block.BlockState blockState) {
final CraftBlockState craftBlockState = (CraftBlockState) blockState;
final IBlockData ibd = craftBlockState.getHandle();
return ibd.canPlace(craftBlockState.getBlock().getCraftWorld().getHandle(), craftBlockState.getPosition());
final BlockState ibd = craftBlockState.getHandle();
return ibd.canSurvive(craftBlockState.getBlock().getCraftWorld().getHandle(), craftBlockState.getPosition());
}
}
+41
View File
@@ -0,0 +1,41 @@
plugins.apply("io.papermc.paperweight.userdev")
dependencies {
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.18.1-R0.1-SNAPSHOT")
compileOnly project(':areashop-interface')
compileOnly project(':areashop-nms')
}
reobfJar {
outputJar.set(file("build/libs/${project.name}-${project.version}.jar"))
}
assemble {
dependsOn(reobfJar)
}
publishing {
publications {
// ... artifact publications
nmsProvider(MavenPublication) {
pom {
group = "me.wiefferink"
artifactId = "$project.name"
version = "$project.version"
scm {
connection = 'scm:git:git://github.com/md5sha256/AreaShop.git'
developerConnection = 'scm:git:ssh://github.com/md5sha256/AreaShop.git'
url = "https://github.com/md5sha256/AreaShop/tree/dev/bleeding"
}
licenses {
license {
name = 'GNU General Public License v3.0'
url = "https://github.com/md5sha256/AreaShop/blob/dev/bleeding/LICENSE"
}
}
}
}
}
}
description = 'AreaShop NMS Helper'
@@ -0,0 +1,46 @@
package me.wiefferink.areashop.nms.v1_18_R1;
import me.wiefferink.areashop.nms.BlockBehaviourHelper;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.block.state.BlockState;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_18_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_18_R1.block.CraftBlock;
import org.bukkit.craftbukkit.v1_18_R1.block.CraftBlockState;
import org.bukkit.craftbukkit.v1_18_R1.block.data.CraftBlockData;
import java.util.Objects;
public class BlockBehaviourImpl implements BlockBehaviourHelper {
@Override
public boolean canPlace(Location location, BlockData blockData) {
Objects.requireNonNull(location.getWorld(), "Null World!");
final BlockPos blockPosition = new BlockPos(location.getX(), location.getY(), location.getZ());
final CraftWorld craftWorld = (CraftWorld) location.getWorld();
final ServerLevel world = craftWorld.getHandle();
final CraftBlockData craftBlockData = (CraftBlockData) blockData;
final BlockState ibd = craftBlockData.getState();
return ibd.canSurvive(world, blockPosition);
}
@Override
public boolean isBlockValid(Block block) {
final CraftBlock craftBlock = (CraftBlock) block;
final CraftWorld craftWorld = (CraftWorld) craftBlock.getWorld();
final ServerLevel world = craftWorld.getHandle();
final BlockState ibd = craftBlock.getNMS();
return ibd.canSurvive(world, craftBlock.getPosition());
}
@Override
public boolean isBlockStateValid(org.bukkit.block.BlockState blockState) {
final CraftBlockState craftBlockState = (CraftBlockState) blockState;
final BlockState ibd = craftBlockState.getHandle();
return ibd.canSurvive(craftBlockState.getBlock().getCraftWorld().getHandle(), craftBlockState.getPosition());
}
}
@@ -0,0 +1,15 @@
package me.wiefferink.areashop.nms.v1_18_R1;
import me.wiefferink.areashop.nms.BlockBehaviourHelper;
import me.wiefferink.areashop.nms.NMS;
public class NMSImpl implements NMS {
private final BlockBehaviourImpl blockBehaviourHelper = new BlockBehaviourImpl();
@Override
public BlockBehaviourHelper blockBehaviourHelper() {
return this.blockBehaviourHelper;
}
}
+25 -1
View File
@@ -2,4 +2,28 @@ dependencies {
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
}
description = 'AreaShop NMS Interface'
publishing {
publications {
// ... artifact publications
nmsProvider(MavenPublication) {
pom {
group = "me.wiefferink"
artifactId = "$project.name"
version = "$project.version"
scm {
connection = 'scm:git:git://github.com/md5sha256/AreaShop.git'
developerConnection = 'scm:git:ssh://github.com/md5sha256/AreaShop.git'
url = "https://github.com/md5sha256/AreaShop/tree/dev/bleeding"
}
licenses {
license {
name = 'GNU General Public License v3.0'
url = "https://github.com/md5sha256/AreaShop/blob/dev/bleeding/LICENSE"
}
}
}
}
}
}
description = 'AreaShop NMS Interface'
+28 -3
View File
@@ -1,8 +1,33 @@
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
compileOnly 'com.sk89q.worldedit:worldedit-bukkit:7.2.5'
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.5'
compileOnly 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT'
compileOnly 'com.sk89q.worldedit:worldedit-bukkit:7.2.8'
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.6'
compileOnly project(':areashop-interface')
}
description = 'AreaShop WorldEdit 7'
publishing {
publications {
// ... artifact publications
areaShop(MavenPublication) {
from components.java
pom {
group = "me.wiefferink"
artifactId = "$project.name"
version = "$project.version"
scm {
connection = 'scm:git:git://github.com/md5sha256/AreaShop.git'
developerConnection = 'scm:git:ssh://github.com/md5sha256/AreaShop.git'
url = "https://github.com/md5sha256/AreaShop/tree/dev/bleeding"
}
licenses {
license {
name = 'GNU General Public License v3.0'
url = "https://github.com/md5sha256/AreaShop/blob/dev/bleeding/LICENSE"
}
}
}
}
}
}
+28 -3
View File
@@ -1,8 +1,33 @@
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
compileOnly 'com.sk89q.worldedit:worldedit-bukkit:7.2.5'
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.5'
compileOnly 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT'
compileOnly 'com.sk89q.worldedit:worldedit-bukkit:7.2.8'
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.6'
compileOnly project(':areashop-interface')
}
description = 'AreaShop WorldGuard 7'
publishing {
publications {
// ... artifact publications
areaShop(MavenPublication) {
from components.java
pom {
group = "me.wiefferink"
artifactId = "$project.name"
version = "$project.version"
scm {
connection = 'scm:git:git://github.com/md5sha256/AreaShop.git'
developerConnection = 'scm:git:ssh://github.com/md5sha256/AreaShop.git'
url = "https://github.com/md5sha256/AreaShop/tree/dev/bleeding"
}
licenses {
license {
name = 'GNU General Public License v3.0'
url = "https://github.com/md5sha256/AreaShop/blob/dev/bleeding/LICENSE"
}
}
}
}
}
}
+13 -1
View File
@@ -1,15 +1,27 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven {
name = 'paper-repo'
url = uri('https://papermc.io/repo/repository/maven-public/')
}
}
}
rootProject.name = 'areashop-parent'
include(':areashop-bukkit-1_13')
include(':areashop-worldguard-7')
include(':areashop-interface')
include(':areashop-nms')
include(':areashop-nms-1-17')
include(':areashop-nms-1-18')
include(':areashop-worldedit-7')
include(':areashop-fastasyncworldedit')
include(':areashop')
project(':areashop').projectDir = file('AreaShop')
project(':areashop-nms').projectDir = file('hooks/areashop-nms')
project(':areashop-nms-1-17').projectDir = file('hooks/areashop-nms-1-17')
project(':areashop-nms-1-18').projectDir = file('hooks/areashop-nms-1-18')
project(':areashop-worldedit-7').projectDir = file('hooks/areashop-worldedit-7')
project(':areashop-worldguard-7').projectDir = file('hooks/areashop-worldguard-7')
project(':areashop-fastasyncworldedit').projectDir = file('hooks/areashop-fastasyncworldedit')
project(':areashop-fastasyncworldedit').projectDir = file('hooks/areashop-fastasyncworldedit')