ARM can now handle worldguard reloades
This commit is contained in:
1 parent
36038274e8
commit
8773e8a039
22 files changed
+105
-142
No files matched your search
@@ -654,7 +654,7 @@ public class AdvancedRegionMarket extends JavaPlugin {
|
||||
priceFormatter.setMaximumFractionDigits(getConfig().getInt("PriceFormatting.maximumFractionDigits"));
|
||||
priceFormatter.setMinimumIntegerDigits(getConfig().getInt("PriceFormatting.minimumIntegerDigits"));
|
||||
priceFormatter.setGroupingUsed(true);
|
||||
Price.setPriceFormater(priceFormatter);
|
||||
Price.setPriceFormatter(priceFormatter);
|
||||
|
||||
if (getConfig().getConfigurationSection("AutoPrice") != null) {
|
||||
AutoPrice.loadAutoprices(getConfig().getConfigurationSection("AutoPrice"));
|
||||
@@ -738,7 +738,7 @@ public class AdvancedRegionMarket extends JavaPlugin {
|
||||
if (worlds == null) {
|
||||
return;
|
||||
}
|
||||
Set<WGRegion> wgRegions = new HashSet<>();
|
||||
HashMap<String, Set<String>> blackListedRegions = new HashMap<>();
|
||||
for (String worldName : worlds) {
|
||||
World world = Bukkit.getWorld(worldName);
|
||||
if (world == null) {
|
||||
@@ -754,10 +754,12 @@ public class AdvancedRegionMarket extends JavaPlugin {
|
||||
if (wgRegion == null) {
|
||||
continue;
|
||||
}
|
||||
wgRegions.add(wgRegion);
|
||||
blackListedRegions.putIfAbsent(worldName, new HashSet<>());
|
||||
Set<String> blackListedRegionsForWorld = blackListedRegions.get(worldName);
|
||||
blackListedRegionsForWorld.add(regionName);
|
||||
}
|
||||
}
|
||||
SignLinkMode.setBlacklistedRegions(wgRegions);
|
||||
SignLinkMode.setBlacklistedRegions(blackListedRegions);
|
||||
}
|
||||
|
||||
private void generateConfigs() {
|
||||
|
||||
@@ -23,13 +23,14 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class SignLinkMode implements Listener {
|
||||
private static List<SignLinkMode> signLinkModeList = new ArrayList<>();
|
||||
private static Set<WGRegion> blacklistedRegions = new HashSet<>();
|
||||
//by Hashed world and regionId
|
||||
private static HashMap<String, Set<String>> blacklistedRegions = new HashMap<>();
|
||||
private Player player;
|
||||
private Preset preset;
|
||||
private Sign sign;
|
||||
@@ -46,7 +47,7 @@ public class SignLinkMode implements Listener {
|
||||
|
||||
public static void reset() {
|
||||
SignLinkMode.signLinkModeList = new ArrayList<>();
|
||||
SignLinkMode.blacklistedRegions = new HashSet<>();
|
||||
SignLinkMode.blacklistedRegions = new HashMap<>();
|
||||
}
|
||||
|
||||
public static SignLinkMode getSignLinkMode(Player player) {
|
||||
@@ -70,7 +71,7 @@ public class SignLinkMode implements Listener {
|
||||
slm.register();
|
||||
}
|
||||
|
||||
public static void setBlacklistedRegions(Set<WGRegion> regions) {
|
||||
public static void setBlacklistedRegions(HashMap<String, Set<String>> regions) {
|
||||
if (regions == null) {
|
||||
return;
|
||||
}
|
||||
@@ -120,7 +121,8 @@ public class SignLinkMode implements Listener {
|
||||
return;
|
||||
}
|
||||
List<WGRegion> regions = AdvancedRegionMarket.getInstance().getWorldGuardInterface().getApplicableRegions(clicklocation.getWorld(), clicklocation);
|
||||
regions.removeAll(SignLinkMode.blacklistedRegions);
|
||||
Set<String> worldBlacklisted = SignLinkMode.blacklistedRegions.get(clicklocation.getWorld().getName());
|
||||
regions.removeIf(x -> worldBlacklisted.contains(x.getId()));
|
||||
if (regions.size() > 1) {
|
||||
throw new InputException(event.getPlayer(), Messages.SIGN_LINK_MODE_COULD_NOT_SELECT_REGION_MULTIPLE_WG_REGIONS);
|
||||
}
|
||||
|
||||
+1
-3
@@ -3,10 +3,8 @@ package net.alex9849.arm.presets.presets;
|
||||
import net.alex9849.arm.Messages;
|
||||
import net.alex9849.arm.regions.ContractRegion;
|
||||
import net.alex9849.arm.regions.Region;
|
||||
import net.alex9849.arm.regions.RentRegion;
|
||||
import net.alex9849.arm.regions.price.Autoprice.AutoPrice;
|
||||
import net.alex9849.arm.regions.price.ContractPrice;
|
||||
import net.alex9849.arm.regions.price.RentPrice;
|
||||
import net.alex9849.inter.WGRegion;
|
||||
import net.alex9849.signs.SignData;
|
||||
import org.bukkit.World;
|
||||
@@ -42,6 +40,6 @@ public class ContractPreset extends CountdownPreset {
|
||||
|
||||
@Override
|
||||
protected ContractRegion generateBasicRegion(WGRegion wgRegion, World world, List<SignData> signs) {
|
||||
return new ContractRegion(wgRegion.getId(), world, signs, new ContractPrice(AutoPrice.DEFAULT), false);
|
||||
return new ContractRegion(wgRegion, world, signs, new ContractPrice(AutoPrice.DEFAULT), false);
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public class RentPreset extends CountdownPreset {
|
||||
|
||||
@Override
|
||||
protected RentRegion generateBasicRegion(WGRegion wgRegion, World world, List<SignData> signs) {
|
||||
return new RentRegion(wgRegion.getId(), world, signs, new RentPrice(AutoPrice.DEFAULT), false);
|
||||
return new RentRegion(wgRegion, world, signs, new RentPrice(AutoPrice.DEFAULT), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package net.alex9849.arm.presets.presets;
|
||||
|
||||
import net.alex9849.arm.Messages;
|
||||
import net.alex9849.arm.regions.ContractRegion;
|
||||
import net.alex9849.arm.regions.Region;
|
||||
import net.alex9849.arm.regions.SellRegion;
|
||||
import net.alex9849.arm.regions.price.Autoprice.AutoPrice;
|
||||
import net.alex9849.arm.regions.price.ContractPrice;
|
||||
import net.alex9849.arm.regions.price.Price;
|
||||
import net.alex9849.inter.WGRegion;
|
||||
import net.alex9849.signs.SignData;
|
||||
@@ -35,7 +33,7 @@ public class SellPreset extends Preset {
|
||||
|
||||
@Override
|
||||
protected SellRegion generateBasicRegion(WGRegion wgRegion, World world, List<SignData> signs) {
|
||||
return new SellRegion(wgRegion.getId(), world, signs, new Price(AutoPrice.DEFAULT), false);
|
||||
return new SellRegion(wgRegion, world, signs, new Price(AutoPrice.DEFAULT), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,7 +8,6 @@ import net.alex9849.arm.exceptions.*;
|
||||
import net.alex9849.arm.regions.price.Autoprice.AutoPrice;
|
||||
import net.alex9849.arm.regions.price.ContractPrice;
|
||||
import net.alex9849.arm.regions.price.Price;
|
||||
import net.alex9849.arm.util.StringReplacer;
|
||||
import net.alex9849.inter.WGRegion;
|
||||
import net.alex9849.signs.SignData;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -29,13 +28,13 @@ public class ContractRegion extends CountdownRegion {
|
||||
private ContractPrice contractPrice;
|
||||
private boolean terminated = false;
|
||||
|
||||
public ContractRegion(String regionId, List<SignData> sellsigns, ContractPrice contractPrice, boolean sold, Region parentRegion) {
|
||||
super(regionId, sellsigns, sold, parentRegion);
|
||||
public ContractRegion(WGRegion region, List<SignData> sellsigns, ContractPrice contractPrice, boolean sold, Region parentRegion) {
|
||||
super(region, sellsigns, sold, parentRegion);
|
||||
this.contractPrice = contractPrice;
|
||||
}
|
||||
|
||||
public ContractRegion(String regionId, World regionworld, List<SignData> sellsigns, ContractPrice contractPrice, boolean sold) {
|
||||
super(regionId, regionworld, sellsigns, sold);
|
||||
public ContractRegion(WGRegion region, World regionworld, List<SignData> sellsigns, ContractPrice contractPrice, boolean sold) {
|
||||
super(region, regionworld, sellsigns, sold);
|
||||
this.contractPrice = contractPrice;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import net.alex9849.arm.AdvancedRegionMarket;
|
||||
import net.alex9849.arm.Messages;
|
||||
import net.alex9849.arm.regions.price.Price;
|
||||
import net.alex9849.arm.util.TimeUtil;
|
||||
import net.alex9849.arm.util.StringReplacer;
|
||||
import net.alex9849.inter.WGRegion;
|
||||
import net.alex9849.signs.SignData;
|
||||
import org.bukkit.World;
|
||||
@@ -19,12 +18,12 @@ public abstract class CountdownRegion extends Region {
|
||||
private static boolean staticSaveNeeded = false;
|
||||
private long payedTill;
|
||||
|
||||
public CountdownRegion(String regionId, List<SignData> sellsigns, boolean sold, Region parentRegion) {
|
||||
super(regionId, sellsigns, sold, parentRegion);
|
||||
public CountdownRegion(WGRegion region, List<SignData> sellsigns, boolean sold, Region parentRegion) {
|
||||
super(region, sellsigns, sold, parentRegion);
|
||||
}
|
||||
|
||||
public CountdownRegion(String regionId, World regionworld, List<SignData> sellsigns, boolean sold) {
|
||||
super(regionId, regionworld, sellsigns, sold);
|
||||
public CountdownRegion(WGRegion region, World regionworld, List<SignData> sellsigns, boolean sold) {
|
||||
super(region, regionworld, sellsigns, sold);
|
||||
}
|
||||
|
||||
public abstract long getExtendTime();
|
||||
|
||||
@@ -20,8 +20,8 @@ import net.alex9849.arm.regionkind.RegionKind;
|
||||
import net.alex9849.arm.regions.price.Autoprice.AutoPrice;
|
||||
import net.alex9849.arm.regions.price.Price;
|
||||
import net.alex9849.arm.util.Saveable;
|
||||
import net.alex9849.arm.util.TimeUtil;
|
||||
import net.alex9849.arm.util.StringReplacer;
|
||||
import net.alex9849.arm.util.TimeUtil;
|
||||
import net.alex9849.inter.WGRegion;
|
||||
import net.alex9849.signs.SignData;
|
||||
import org.bukkit.*;
|
||||
@@ -41,7 +41,7 @@ import java.util.logging.Level;
|
||||
public abstract class Region implements Saveable {
|
||||
private final AdvancedRegionMarket plugin = AdvancedRegionMarket.getInstance();
|
||||
private Integer m2Amount;
|
||||
private final String regionId;
|
||||
private WGRegion region;
|
||||
private final World regionworld;
|
||||
private ArrayList<SignData> sellsign;
|
||||
private Region parentRegion;
|
||||
@@ -72,8 +72,8 @@ public abstract class Region implements Saveable {
|
||||
/* ######################################
|
||||
############### Constructors ############
|
||||
#########################################*/
|
||||
public Region(String regionId, List<SignData> sellsigns, boolean sold, Region parentRegion) {
|
||||
this(regionId, parentRegion.getRegionworld(), sellsigns, sold);
|
||||
public Region(WGRegion region, List<SignData> sellsigns, boolean sold, Region parentRegion) {
|
||||
this(region, parentRegion.getRegionworld(), sellsigns, sold);
|
||||
if (parentRegion.isSubregion()) {
|
||||
throw new IllegalArgumentException("Subregions can't be parent regions!");
|
||||
}
|
||||
@@ -91,15 +91,15 @@ public abstract class Region implements Saveable {
|
||||
parentRegion.addSubRegion(this);
|
||||
}
|
||||
|
||||
public Region(String regionId, World regionworld, List<SignData> sellsigns, boolean sold) {
|
||||
this.regionId = regionId;
|
||||
public Region(WGRegion region, World regionworld, List<SignData> sellsigns, boolean sold) {
|
||||
this.region = region;
|
||||
this.sellsign = new ArrayList<>(sellsigns);
|
||||
this.sold = sold;
|
||||
this.regionworld = regionworld;
|
||||
this.subregions = new HashSet<>();
|
||||
|
||||
File pluginfolder = Bukkit.getPluginManager().getPlugin("AdvancedRegionMarket").getDataFolder();
|
||||
File builtblocksdic = new File(pluginfolder + "/schematics/" + this.regionworld.getName() + "/" + regionId + "/builtblocks.builtblocks");
|
||||
File builtblocksdic = new File(pluginfolder + "/schematics/" + this.regionworld.getName() + "/" + region.getId() + "/builtblocks.builtblocks");
|
||||
if (builtblocksdic.exists()) {
|
||||
try {
|
||||
FileReader filereader = new FileReader(builtblocksdic);
|
||||
@@ -141,10 +141,6 @@ public abstract class Region implements Saveable {
|
||||
return this.isUserRestorable;
|
||||
}
|
||||
|
||||
public String getRegionId() {
|
||||
return this.regionId;
|
||||
}
|
||||
|
||||
public boolean isSubregion() {
|
||||
return this.parentRegion != null;
|
||||
}
|
||||
@@ -338,7 +334,11 @@ public abstract class Region implements Saveable {
|
||||
}
|
||||
|
||||
public WGRegion getRegion() {
|
||||
return plugin.getWorldGuardInterface().getRegion(this.regionworld, this.regionId);
|
||||
WGRegion wgRegion = plugin.getWorldGuardInterface().getRegion(this.regionworld, this.region.getId());
|
||||
if (wgRegion != null && wgRegion.unwrap() != this.region.unwrap()) {
|
||||
this.region = wgRegion;
|
||||
}
|
||||
return region;
|
||||
}
|
||||
|
||||
public Set<Region> getSubregions() {
|
||||
@@ -622,9 +622,9 @@ public abstract class Region implements Saveable {
|
||||
protected HashMap<String, Supplier<String>> getVariableReplacements() {
|
||||
HashMap<String, Supplier<String>> variableReplacements = new HashMap<>();
|
||||
variableReplacements.put("%prefix%", () -> Messages.PREFIX);
|
||||
variableReplacements.put("%regionid%", () -> this.regionId);
|
||||
variableReplacements.put("%regionid%", () -> this.getRegion().getId());
|
||||
variableReplacements.put("%maxmembers%", () -> String.valueOf((this.getMaxMembers() < 0) ? Messages.UNLIMITED : this.getMaxMembers()));
|
||||
variableReplacements.put("%region%", () -> this.regionId);
|
||||
variableReplacements.put("%region%", () -> this.getRegion().getId());
|
||||
variableReplacements.put("%price%", () -> Price.formatPrice(this.getPricePerPeriod()));
|
||||
variableReplacements.put("%dimensions%", this::getDimensions);
|
||||
variableReplacements.put("%priceperm2%", () -> Price.formatPrice(this.getPricePerM2()));
|
||||
@@ -707,7 +707,7 @@ public abstract class Region implements Saveable {
|
||||
return Messages.convertYesNo(this.getPriceObject().isAutoPrice());
|
||||
});
|
||||
variableReplacements.put("%subregions%", () ->
|
||||
Messages.getStringList(this.subregions, x -> x.regionId, ", "));
|
||||
Messages.getStringList(this.subregions, x -> x.getRegion().getId(), ", "));
|
||||
variableReplacements.put("%members%", () ->
|
||||
Messages.getStringList(this.getRegion().getMembers(), x ->
|
||||
Messages.getStringValue(Bukkit.getOfflinePlayer(x).getName(), y -> y, Messages.UNKNOWN_UUID)
|
||||
@@ -775,9 +775,9 @@ public abstract class Region implements Saveable {
|
||||
if (this.builtblocks.add(loc.hashCode())) {
|
||||
try {
|
||||
File pluginfolder = Bukkit.getPluginManager().getPlugin("AdvancedRegionMarket").getDataFolder();
|
||||
File builtblocksdic = new File(pluginfolder + "/schematics/" + this.regionworld.getName() + "/" + regionId + "/builtblocks.builtblocks");
|
||||
File builtblocksdic = new File(pluginfolder + "/schematics/" + this.regionworld.getName() + "/" + getRegion().getId() + "/builtblocks.builtblocks");
|
||||
if (!builtblocksdic.exists()) {
|
||||
File builtblocksfolder = new File(pluginfolder + "/schematics/" + this.regionworld.getName() + "/" + regionId);
|
||||
File builtblocksfolder = new File(pluginfolder + "/schematics/" + this.regionworld.getName() + "/" + getRegion().getId());
|
||||
builtblocksfolder.mkdirs();
|
||||
builtblocksdic.createNewFile();
|
||||
}
|
||||
@@ -928,7 +928,7 @@ public abstract class Region implements Saveable {
|
||||
|
||||
public File getRegionSchematicFolder() {
|
||||
File schematicFolder = new File(AdvancedRegionMarket.getInstance().getDataFolder() + "/schematics");
|
||||
return new File(schematicFolder + "/" + this.getRegionworld().getName() + "/" + this.regionId);
|
||||
return new File(schematicFolder + "/" + this.getRegionworld().getName() + "/" + this.getRegion().getId());
|
||||
}
|
||||
|
||||
public void restoreRegion(ActionReason actionReason, boolean logToConsole, boolean preventBackup) throws SchematicNotFoundException, ProtectionOfContinuanceException {
|
||||
@@ -951,7 +951,7 @@ public abstract class Region implements Saveable {
|
||||
}
|
||||
|
||||
File schematicFolder = new File(AdvancedRegionMarket.getInstance().getDataFolder() + "/schematics");
|
||||
File regionsSchematicPathWithoutFileEnding = new File(schematicFolder + "/" + this.getRegionworld().getName() + "/" + this.regionId + "/schematic");
|
||||
File regionsSchematicPathWithoutFileEnding = new File(schematicFolder + "/" + this.getRegionworld().getName() + "/" + this.getRegion().getId() + "/schematic");
|
||||
|
||||
AdvancedRegionMarket.getInstance().getWorldEditInterface().restoreSchematic(this.getRegion(), this.getRegionworld(), regionsSchematicPathWithoutFileEnding);
|
||||
|
||||
@@ -983,7 +983,7 @@ public abstract class Region implements Saveable {
|
||||
|
||||
public void resetBuiltBlocks() {
|
||||
File pluginfolder = Bukkit.getPluginManager().getPlugin("AdvancedRegionMarket").getDataFolder();
|
||||
File builtblocksdic = new File(pluginfolder + "/schematics/" + this.regionworld.getName() + "/" + regionId + "/builtblocks.builtblocks");
|
||||
File builtblocksdic = new File(pluginfolder + "/schematics/" + this.regionworld.getName() + "/" + getRegion().getId() + "/builtblocks.builtblocks");
|
||||
if (builtblocksdic.exists()) {
|
||||
builtblocksdic.delete();
|
||||
this.builtblocks = new HashSet<>();
|
||||
@@ -1299,7 +1299,7 @@ public abstract class Region implements Saveable {
|
||||
yamlConfiguration.set("teleportLoc", null);
|
||||
}
|
||||
for (Region subregion : this.getSubregions()) {
|
||||
yamlConfiguration.set("subregions." + subregion.regionId, subregion.toConfigurationSection());
|
||||
yamlConfiguration.set("subregions." + subregion.getRegion().getId(), subregion.toConfigurationSection());
|
||||
}
|
||||
}
|
||||
return yamlConfiguration;
|
||||
|
||||
@@ -119,7 +119,7 @@ public class RegionManager extends YamlFileManager<Region> {
|
||||
|
||||
if (wgRegion != null) {
|
||||
fileupdated |= updateDefaults(regionSection);
|
||||
Region armRegion = parseRegion(regionSection, regionWorld, wgRegion.getId());
|
||||
Region armRegion = parseRegion(regionSection, regionWorld, wgRegion);
|
||||
loadedRegions.add(armRegion);
|
||||
}
|
||||
}
|
||||
@@ -153,7 +153,7 @@ public class RegionManager extends YamlFileManager<Region> {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static Region parseRegion(ConfigurationSection regionSection, World regionWorld, String regionId) {
|
||||
private static Region parseRegion(ConfigurationSection regionSection, World regionWorld, WGRegion wgRegion) {
|
||||
boolean sold = regionSection.getBoolean("sold");
|
||||
String kind = regionSection.getString("kind");
|
||||
String flagGroupString = regionSection.getString("flagGroup");
|
||||
@@ -203,7 +203,7 @@ public class RegionManager extends YamlFileManager<Region> {
|
||||
rentPrice = new RentPrice(AutoPrice.getAutoprice(autoPriceString));
|
||||
} else {
|
||||
AdvancedRegionMarket.getInstance().getLogger().log(Level.WARNING, "Could not find Autoprice '"
|
||||
+ autoPriceString + "' for region + '" + regionId + "'! Using Default Autoprice!");
|
||||
+ autoPriceString + "' for region + '" + wgRegion.getId() + "'! Using Default Autoprice!");
|
||||
rentPrice = new RentPrice(AutoPrice.DEFAULT);
|
||||
}
|
||||
} else {
|
||||
@@ -214,13 +214,13 @@ public class RegionManager extends YamlFileManager<Region> {
|
||||
rentPrice = new RentPrice(price, extendTime, maxExtendTime);
|
||||
} catch (IllegalArgumentException e) {
|
||||
AdvancedRegionMarket.getInstance().getLogger().log(Level.WARNING, "'RentPrice for region '"
|
||||
+ regionId + "' has an extendTime or maxExtendTime smaller than 1 second! Replacing it with "
|
||||
+ wgRegion.getId() + "' has an extendTime or maxExtendTime smaller than 1 second! Replacing it with "
|
||||
+ "if an extendTime and maxExtendTime of one second!");
|
||||
rentPrice = new RentPrice(price, 1000, 1000);
|
||||
}
|
||||
}
|
||||
long payedtill = regionSection.getLong("payedTill");
|
||||
RentRegion rentRegion = new RentRegion(regionId, regionWorld, regionsigns, rentPrice, sold);
|
||||
RentRegion rentRegion = new RentRegion(wgRegion, regionWorld, regionsigns, rentPrice, sold);
|
||||
rentRegion.setPayedTill(payedtill);
|
||||
region = rentRegion;
|
||||
|
||||
@@ -232,7 +232,7 @@ public class RegionManager extends YamlFileManager<Region> {
|
||||
contractPrice = new ContractPrice(AutoPrice.getAutoprice(autoPriceString));
|
||||
} else {
|
||||
AdvancedRegionMarket.getInstance().getLogger().log(Level.WARNING, "Could not find Autoprice '"
|
||||
+ autoPriceString + "' for region + '" + regionId + "'! Using Default Autoprice!");
|
||||
+ autoPriceString + "' for region + '" + wgRegion.getId() + "'! Using Default Autoprice!");
|
||||
contractPrice = new ContractPrice(AutoPrice.DEFAULT);
|
||||
}
|
||||
} else {
|
||||
@@ -242,14 +242,14 @@ public class RegionManager extends YamlFileManager<Region> {
|
||||
contractPrice = new ContractPrice(price, extendTime);
|
||||
} catch (IllegalArgumentException e) {
|
||||
AdvancedRegionMarket.getInstance().getLogger().log(Level.WARNING, "ContractPrice for region '"
|
||||
+ regionId + "' has an extendTime smaller than 1 second! Replacing it with "
|
||||
+ wgRegion.getId() + "' has an extendTime smaller than 1 second! Replacing it with "
|
||||
+ "if an extendTime of one second!");
|
||||
contractPrice = new ContractPrice(price, 1000);
|
||||
}
|
||||
}
|
||||
long payedtill = regionSection.getLong("payedTill");
|
||||
Boolean terminated = regionSection.getBoolean("terminated");
|
||||
ContractRegion contractRegion = new ContractRegion(regionId, regionWorld, regionsigns, contractPrice, sold);
|
||||
ContractRegion contractRegion = new ContractRegion(wgRegion, regionWorld, regionsigns, contractPrice, sold);
|
||||
contractRegion.setTerminated(terminated);
|
||||
contractRegion.setPayedTill(payedtill);
|
||||
region = contractRegion;
|
||||
@@ -260,14 +260,14 @@ public class RegionManager extends YamlFileManager<Region> {
|
||||
sellPrice = new Price(AutoPrice.getAutoprice(autoPriceString));
|
||||
} else {
|
||||
AdvancedRegionMarket.getInstance().getLogger().log(Level.WARNING, "Could not find Autoprice '"
|
||||
+ autoPriceString + "' for region + '" + regionId + "'! Using Default Autoprice!");
|
||||
+ autoPriceString + "' for region + '" + wgRegion.getId() + "'! Using Default Autoprice!");
|
||||
sellPrice = new Price(AutoPrice.DEFAULT);
|
||||
}
|
||||
} else {
|
||||
double price = regionSection.getDouble("price");
|
||||
sellPrice = new Price(price);
|
||||
}
|
||||
region = new SellRegion(regionId, regionWorld, regionsigns, sellPrice, sold);
|
||||
region = new SellRegion(wgRegion, regionWorld, regionsigns, sellPrice, sold);
|
||||
}
|
||||
|
||||
if (regionSection.getConfigurationSection("subregions") != null) {
|
||||
@@ -275,7 +275,7 @@ public class RegionManager extends YamlFileManager<Region> {
|
||||
for (String subregionName : subregionsection) {
|
||||
WGRegion subWGRegion = AdvancedRegionMarket.getInstance().getWorldGuardInterface().getRegion(regionWorld, subregionName);
|
||||
if (subWGRegion != null) {
|
||||
parseSubRegion(regionSection.getConfigurationSection("subregions." + subregionName), subregionName, region);
|
||||
parseSubRegion(regionSection.getConfigurationSection("subregions." + subregionName), subWGRegion, region);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -319,7 +319,7 @@ public class RegionManager extends YamlFileManager<Region> {
|
||||
WGRegion subWGRegion = subRegion.getRegion();
|
||||
|
||||
if (AdvancedRegionMarket.getInstance().getPluginSettings().isAllowParentRegionOwnersBuildOnSubregions()) {
|
||||
if (subWGRegion.getParent() == null || !subWGRegion.getParent().equals(parentRegion)) {
|
||||
if (subWGRegion.getParent() == null || subWGRegion.getParent().unwrap() != parentRegion.unwrap()) {
|
||||
subWGRegion.setParent(parentRegion);
|
||||
}
|
||||
} else {
|
||||
@@ -332,7 +332,7 @@ public class RegionManager extends YamlFileManager<Region> {
|
||||
return region;
|
||||
}
|
||||
|
||||
private static Region parseSubRegion(ConfigurationSection section, String subregionId, Region parentRegion) {
|
||||
private static Region parseSubRegion(ConfigurationSection section, WGRegion wgSubregion, Region parentRegion) {
|
||||
double subregPrice = section.getDouble("price");
|
||||
boolean subregIsSold = section.getBoolean("sold");
|
||||
boolean subregIsHotel = section.getBoolean("isHotel");
|
||||
@@ -347,7 +347,7 @@ public class RegionManager extends YamlFileManager<Region> {
|
||||
long subregmaxExtendTime = section.getLong("maxExtendTime");
|
||||
long subregextendTime = section.getLong("extendTime");
|
||||
RentPrice subPrice = new RentPrice(subregPrice, subregextendTime, subregmaxExtendTime);
|
||||
RentRegion rentRegion = new RentRegion(subregionId, subregionsigns, subPrice, subregIsSold, parentRegion);
|
||||
RentRegion rentRegion = new RentRegion(wgSubregion, subregionsigns, subPrice, subregIsSold, parentRegion);
|
||||
rentRegion.setPayedTill(subregpayedtill);
|
||||
region = rentRegion;
|
||||
|
||||
@@ -356,14 +356,14 @@ public class RegionManager extends YamlFileManager<Region> {
|
||||
long subregextendTime = section.getLong("extendTime");
|
||||
Boolean subregterminated = section.getBoolean("terminated");
|
||||
ContractPrice subPrice = new ContractPrice(subregPrice, subregextendTime);
|
||||
ContractRegion contractRegion = new ContractRegion(subregionId, subregionsigns, subPrice, subregIsSold, parentRegion);
|
||||
ContractRegion contractRegion = new ContractRegion(wgSubregion, subregionsigns, subPrice, subregIsSold, parentRegion);
|
||||
contractRegion.setPayedTill(subregpayedtill);
|
||||
contractRegion.setTerminated(subregterminated);
|
||||
region = contractRegion;
|
||||
|
||||
} else {
|
||||
Price subPrice = new Price(subregPrice);
|
||||
region = new SellRegion(subregionId, subregionsigns, subPrice, subregIsSold, parentRegion);
|
||||
region = new SellRegion(wgSubregion, subregionsigns, subPrice, subregIsSold, parentRegion);
|
||||
}
|
||||
region.setHotel(subregIsHotel);
|
||||
region.setLastReset(sublastreset);
|
||||
@@ -532,11 +532,11 @@ public class RegionManager extends YamlFileManager<Region> {
|
||||
|
||||
public Region getRegion(WGRegion wgRegion) {
|
||||
for (Region region : this) {
|
||||
if (region.getRegion().equals(wgRegion)) {
|
||||
if (region.getRegion().unwrap() == wgRegion.unwrap()) {
|
||||
return region;
|
||||
}
|
||||
for (Region subregion : region.getSubregions()) {
|
||||
if (subregion.getRegion().equals(wgRegion)) {
|
||||
if (subregion.getRegion().unwrap() == wgRegion.unwrap()) {
|
||||
return subregion;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import net.alex9849.arm.regions.price.Autoprice.AutoPrice;
|
||||
import net.alex9849.arm.regions.price.Price;
|
||||
import net.alex9849.arm.regions.price.RentPrice;
|
||||
import net.alex9849.arm.util.TimeUtil;
|
||||
import net.alex9849.arm.util.StringReplacer;
|
||||
import net.alex9849.inter.WGRegion;
|
||||
import net.alex9849.signs.SignData;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -28,13 +27,13 @@ import java.util.logging.Level;
|
||||
public class RentRegion extends CountdownRegion {
|
||||
private RentPrice rentPrice;
|
||||
|
||||
public RentRegion(String regionId, List<SignData> sellsigns, RentPrice rentPrice, boolean sold, Region parentRegion) {
|
||||
super(regionId, sellsigns, sold, parentRegion);
|
||||
public RentRegion(WGRegion region, List<SignData> sellsigns, RentPrice rentPrice, boolean sold, Region parentRegion) {
|
||||
super(region, sellsigns, sold, parentRegion);
|
||||
this.rentPrice = rentPrice;
|
||||
}
|
||||
|
||||
public RentRegion(String regionId, World regionworld, List<SignData> sellsigns, RentPrice rentPrice, boolean sold) {
|
||||
super(regionId, regionworld, sellsigns, sold);
|
||||
public RentRegion(WGRegion region, World regionworld, List<SignData> sellsigns, RentPrice rentPrice, boolean sold) {
|
||||
super(region, regionworld, sellsigns, sold);
|
||||
this.rentPrice = rentPrice;
|
||||
}
|
||||
|
||||
@@ -44,7 +43,7 @@ public class RentRegion extends CountdownRegion {
|
||||
}
|
||||
|
||||
public void signClickAction(Player player) throws OutOfLimitExeption, AlreadySoldException, NotSoldException, NoPermissionException, NotEnoughMoneyException, RegionNotOwnException, ProtectionOfContinuanceException {
|
||||
if(this.isSold()) {
|
||||
if (this.isSold()) {
|
||||
this.extend(player);
|
||||
} else {
|
||||
this.buy(player);
|
||||
|
||||
@@ -17,13 +17,13 @@ public class SellRegion extends Region {
|
||||
private Price price;
|
||||
|
||||
|
||||
public SellRegion(String regionId, List<SignData> sellSigns, Price price, boolean sold, Region parentRegion) {
|
||||
super(regionId, sellSigns, sold, parentRegion);
|
||||
public SellRegion(WGRegion region, List<SignData> sellSigns, Price price, boolean sold, Region parentRegion) {
|
||||
super(region, sellSigns, sold, parentRegion);
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public SellRegion(String regionId, World regionWorld, List<SignData> sellSigns, Price price, boolean sold) {
|
||||
super(regionId, regionWorld, sellSigns, sold);
|
||||
public SellRegion(WGRegion region, World regionWorld, List<SignData> sellSigns, Price price, boolean sold) {
|
||||
super(region, regionWorld, sellSigns, sold);
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package net.alex9849.arm.regions.price;
|
||||
|
||||
import net.alex9849.arm.AdvancedRegionMarket;
|
||||
import net.alex9849.arm.regions.price.Autoprice.AutoPrice;
|
||||
import net.alex9849.inter.WGRegion;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
|
||||
public class Price {
|
||||
private static NumberFormat priceFormater;
|
||||
private AdvancedRegionMarket plugin = AdvancedRegionMarket.getInstance();
|
||||
private static NumberFormat priceFormatter;
|
||||
protected AutoPrice autoPrice;
|
||||
protected double price;
|
||||
protected Double cachedAutoPrice;
|
||||
@@ -14,6 +16,7 @@ public class Price {
|
||||
|
||||
/**
|
||||
* Creates a price Object, that can be used for SellRegions
|
||||
*
|
||||
* @param price the price. Needs to be positive. If negative price will automatically be negated!
|
||||
*/
|
||||
public Price(double price) {
|
||||
@@ -31,16 +34,16 @@ public class Price {
|
||||
this.price = 0;
|
||||
}
|
||||
|
||||
public static void setPriceFormater(NumberFormat formater) {
|
||||
Price.priceFormater = formater;
|
||||
public static void setPriceFormatter(NumberFormat formatter) {
|
||||
Price.priceFormatter = formatter;
|
||||
}
|
||||
|
||||
public static String formatPrice(double price) {
|
||||
return Price.priceFormater.format(price).replace("\u00A0", " ");
|
||||
return Price.priceFormatter.format(price).replace("\u00A0", " ");
|
||||
}
|
||||
|
||||
public double calcPrice(WGRegion wgRegion) {
|
||||
if(this.cachedWgRegion == null || this.cachedWgRegion != wgRegion) {
|
||||
if (this.cachedWgRegion == null || this.cachedWgRegion.unwrap() != wgRegion.unwrap()) {
|
||||
this.cachedWgRegion = wgRegion;
|
||||
this.cachedAutoPrice = null;
|
||||
}
|
||||
|
||||
+3
-3
@@ -63,7 +63,7 @@ public class SubSignCreationListener implements Listener {
|
||||
signList.add(signData);
|
||||
Price subregPrice = new Price(price);
|
||||
this.subRegionCreator.saveWorldGuardRegion();
|
||||
SellRegion sellRegion = new SellRegion(this.subRegionCreator.getSubRegion().getId(), signList, subregPrice,
|
||||
SellRegion sellRegion = new SellRegion(this.subRegionCreator.getSubRegion(), signList, subregPrice,
|
||||
false, this.subRegionCreator.getParentRegion());
|
||||
event.setCancelled(true);
|
||||
sellRegion.updateSigns();
|
||||
@@ -110,7 +110,7 @@ public class SubSignCreationListener implements Listener {
|
||||
signList.add(signData);
|
||||
this.subRegionCreator.saveWorldGuardRegion();
|
||||
RentPrice rentPrice = new RentPrice(price, extendPerClick, maxExtendTime);
|
||||
RentRegion rentRegion = new RentRegion(this.subRegionCreator.getSubRegion().getId(), signList, rentPrice,
|
||||
RentRegion rentRegion = new RentRegion(this.subRegionCreator.getSubRegion(), signList, rentPrice,
|
||||
false, this.subRegionCreator.getParentRegion());
|
||||
event.setCancelled(true);
|
||||
rentRegion.updateSigns();
|
||||
@@ -154,7 +154,7 @@ public class SubSignCreationListener implements Listener {
|
||||
signList.add(signData);
|
||||
ContractPrice contractPrice = new ContractPrice(price, extendtime);
|
||||
this.subRegionCreator.saveWorldGuardRegion();
|
||||
ContractRegion contractRegion = new ContractRegion(this.subRegionCreator.getSubRegion().getId(), signList,
|
||||
ContractRegion contractRegion = new ContractRegion(this.subRegionCreator.getSubRegion(), signList,
|
||||
contractPrice, false, this.subRegionCreator.getParentRegion());
|
||||
event.setCancelled(true);
|
||||
contractRegion.updateSigns();
|
||||
|
||||
@@ -37,14 +37,14 @@ public interface WGRegion {
|
||||
|
||||
boolean contains(int x, int y, int z);
|
||||
|
||||
boolean equals(WGRegion wgRegion);
|
||||
|
||||
WGRegion getParent();
|
||||
|
||||
void setParent(WGRegion wgRegion);
|
||||
|
||||
int getPriority();
|
||||
|
||||
Object unwrap();
|
||||
|
||||
void setPriority(int priority);
|
||||
|
||||
List<Vector> getPoints();
|
||||
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
package net.alex9849.advancedregionmarket.placeholders.implementations;
|
||||
|
||||
import net.alex9849.arm.AdvancedRegionMarket;
|
||||
import net.alex9849.advancedregionmarket.placeholders.AbstractOfflinePlayerPlaceholder;
|
||||
import net.alex9849.arm.regions.Region;
|
||||
import net.alex9849.arm.AdvancedRegionMarket;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
@@ -26,7 +25,7 @@ public class AccessRegionsPlaceholder extends AbstractOfflinePlayerPlaceholder {
|
||||
return "";
|
||||
}
|
||||
return plugin.getRegionManager().getRegionsByMember(uuid)
|
||||
.stream().map(Region::getRegionId).collect(Collectors.joining(", "));
|
||||
.stream().map(x -> x.getRegion().getId()).collect(Collectors.joining(", "));
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package net.alex9849.advancedregionmarket.placeholders.implementations;
|
||||
|
||||
import net.alex9849.arm.AdvancedRegionMarket;
|
||||
import net.alex9849.advancedregionmarket.placeholders.AbstractOfflinePlayerPlaceholder;
|
||||
import net.alex9849.arm.AdvancedRegionMarket;
|
||||
import net.alex9849.arm.regions.Region;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@@ -29,7 +29,7 @@ public class MemberRegionsPlaceholder extends AbstractOfflinePlayerPlaceholder {
|
||||
}
|
||||
Set<Region> accessRegions = new HashSet<>(plugin.getRegionManager().getRegionsByMember(uuid));
|
||||
accessRegions.addAll(plugin.getRegionManager().getRegionsByMember(uuid));
|
||||
return accessRegions.stream().map(Region::getRegionId).collect(Collectors.joining(", "));
|
||||
return accessRegions.stream().map(x -> x.getRegion().getId()).collect(Collectors.joining(", "));
|
||||
}
|
||||
|
||||
}
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
package net.alex9849.advancedregionmarket.placeholders.implementations;
|
||||
|
||||
import net.alex9849.arm.AdvancedRegionMarket;
|
||||
import net.alex9849.advancedregionmarket.placeholders.AbstractOfflinePlayerPlaceholder;
|
||||
import net.alex9849.arm.regions.Region;
|
||||
import net.alex9849.arm.AdvancedRegionMarket;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
@@ -26,6 +25,6 @@ public class OwnedRegionsPlaceholder extends AbstractOfflinePlayerPlaceholder {
|
||||
return "";
|
||||
}
|
||||
return plugin.getRegionManager().getRegionsByOwner(uuid)
|
||||
.stream().map(Region::getRegionId).collect(Collectors.joining(", "));
|
||||
.stream().map(x -> x.getRegion().getId()).collect(Collectors.joining(", "));
|
||||
}
|
||||
}
|
||||
+2
-5
@@ -1,7 +1,7 @@
|
||||
package net.alex9849.advancedregionmarket.placeholders.implementations;
|
||||
|
||||
import net.alex9849.arm.AdvancedRegionMarket;
|
||||
import net.alex9849.advancedregionmarket.placeholders.AbstractOfflinePlayerPlaceholder;
|
||||
import net.alex9849.arm.AdvancedRegionMarket;
|
||||
import net.alex9849.arm.regions.Region;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -23,9 +23,6 @@ public class RegionIdAtLocationPlaceholder extends AbstractOfflinePlayerPlacehol
|
||||
List<Region> regionList = plugin.getRegionManager().getRegionsByLocation(player.getLocation());
|
||||
Region region = null;
|
||||
for(Region currentRegion : regionList) {
|
||||
if(currentRegion.getRegion() == null) {
|
||||
continue;
|
||||
}
|
||||
if(region == null || region.getRegion().getPriority() < currentRegion.getRegion().getPriority()) {
|
||||
region = currentRegion;
|
||||
}
|
||||
@@ -33,6 +30,6 @@ public class RegionIdAtLocationPlaceholder extends AbstractOfflinePlayerPlacehol
|
||||
if(region == null) {
|
||||
return "";
|
||||
}
|
||||
return region.getRegionId();
|
||||
return region.getRegion().getId();
|
||||
}
|
||||
}
|
||||
@@ -86,12 +86,6 @@ public class WG6Region implements WGRegion {
|
||||
return this.region.contains(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(WGRegion wgRegion) {
|
||||
WG6Region wg6Region = (WG6Region) wgRegion;
|
||||
return wg6Region.getRegion() == this.region;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WGRegion getParent() {
|
||||
if (this.getRegion().getParent() != null) {
|
||||
@@ -164,6 +158,10 @@ public class WG6Region implements WGRegion {
|
||||
deleteFlags(this.region.getFlags().keySet().toArray(flagarr));
|
||||
}
|
||||
|
||||
public Object unwrap() {
|
||||
return region;
|
||||
}
|
||||
|
||||
public Object getFlagSetting(Flag flag) {
|
||||
return this.region.getFlag(flag);
|
||||
}
|
||||
|
||||
@@ -13,12 +13,10 @@ import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class WorldGuard6_1 extends WorldGuardInterface {
|
||||
private HashMap<ProtectedRegion, WG6Region> createdRegions = new HashMap<ProtectedRegion, WG6Region>();
|
||||
|
||||
@Override
|
||||
public RegionManager getRegionManager(World world) {
|
||||
@@ -36,7 +34,7 @@ public class WorldGuard6_1 extends WorldGuardInterface {
|
||||
return null;
|
||||
}
|
||||
|
||||
return getUniqueRegion(region);
|
||||
return new WG6Region(region);
|
||||
}
|
||||
|
||||
public boolean canBuild(Player player, Location location) {
|
||||
@@ -46,8 +44,7 @@ public class WorldGuard6_1 extends WorldGuardInterface {
|
||||
@Override
|
||||
public WGRegion createRegion(String regionID, Location pos1, Location pos2) {
|
||||
ProtectedRegion protectedRegion = new ProtectedCuboidRegion(regionID, new BlockVector(pos1.getBlockX(), pos1.getBlockY(), pos1.getBlockZ()), new BlockVector(pos2.getBlockX(), pos2.getBlockY(), pos2.getBlockZ()));
|
||||
WG6Region returnRegion = getUniqueRegion(protectedRegion);
|
||||
return returnRegion;
|
||||
return new WG6Region(protectedRegion);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -55,7 +52,7 @@ public class WorldGuard6_1 extends WorldGuardInterface {
|
||||
List<ProtectedRegion> protectedRegions = new ArrayList<ProtectedRegion>(WorldGuardPlugin.inst().getRegionManager(world).getApplicableRegions(loc).getRegions());
|
||||
List<WGRegion> wg6Regions = new ArrayList<WGRegion>();
|
||||
for (ProtectedRegion pRegion : protectedRegions) {
|
||||
wg6Regions.add(getUniqueRegion(pRegion));
|
||||
wg6Regions.add(new WG6Region(pRegion));
|
||||
}
|
||||
return wg6Regions;
|
||||
}
|
||||
@@ -72,18 +69,6 @@ public class WorldGuard6_1 extends WorldGuardInterface {
|
||||
getRegionManager(world).removeRegion(wg6Region.getRegion().getId());
|
||||
}
|
||||
|
||||
private WG6Region getUniqueRegion(ProtectedRegion protectedRegion) {
|
||||
if (protectedRegion == null) {
|
||||
return null;
|
||||
}
|
||||
if (createdRegions.containsKey(protectedRegion)) {
|
||||
return createdRegions.get(protectedRegion);
|
||||
}
|
||||
WG6Region wg7Region = new WG6Region(protectedRegion);
|
||||
createdRegions.put(protectedRegion, wg7Region);
|
||||
return wg7Region;
|
||||
}
|
||||
|
||||
public Flag fuzzyMatchFlag(String id) {
|
||||
return DefaultFlag.fuzzyMatchFlag(id);
|
||||
}
|
||||
|
||||
@@ -91,9 +91,8 @@ public class WG7Region implements WGRegion {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(WGRegion wgRegion) {
|
||||
WG7Region wg7Region = (WG7Region) wgRegion;
|
||||
return wg7Region.getRegion() == this.region;
|
||||
public Object unwrap() {
|
||||
return region;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,12 +15,10 @@ import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class WorldGuard7 extends WorldGuardInterface {
|
||||
private HashMap<ProtectedRegion, WG7Region> createdRegions = new HashMap<ProtectedRegion, WG7Region>();
|
||||
|
||||
public RegionManager getRegionManager(World world) {
|
||||
return WorldGuard.getInstance().getPlatform().getRegionContainer().get(new BukkitWorld(world));
|
||||
@@ -37,7 +35,7 @@ public class WorldGuard7 extends WorldGuardInterface {
|
||||
return null;
|
||||
}
|
||||
|
||||
return getLatestRegion(region);
|
||||
return new WG7Region(region);
|
||||
}
|
||||
|
||||
public boolean canBuild(Player player, Location location) {
|
||||
@@ -57,7 +55,7 @@ public class WorldGuard7 extends WorldGuardInterface {
|
||||
ProtectedRegion protectedRegion = new ProtectedCuboidRegion(regionID,
|
||||
BlockVector3.at(pos1.getBlockX(), pos1.getBlockY(), pos1.getBlockZ()),
|
||||
BlockVector3.at(pos2.getBlockX(), pos2.getBlockY(), pos2.getBlockZ()));
|
||||
return getLatestRegion(protectedRegion);
|
||||
return new WG7Region(protectedRegion);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,7 +64,7 @@ public class WorldGuard7 extends WorldGuardInterface {
|
||||
.getApplicableRegions(BlockVector3.at(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())).getRegions());
|
||||
List<WGRegion> wg7Regions = new ArrayList<WGRegion>();
|
||||
for (ProtectedRegion pRegion : protectedRegions) {
|
||||
wg7Regions.add(getLatestRegion(pRegion));
|
||||
wg7Regions.add(new WG7Region(pRegion));
|
||||
}
|
||||
return wg7Regions;
|
||||
}
|
||||
@@ -83,18 +81,6 @@ public class WorldGuard7 extends WorldGuardInterface {
|
||||
getRegionManager(world).removeRegion(wg7Region.getRegion().getId());
|
||||
}
|
||||
|
||||
private WG7Region getLatestRegion(ProtectedRegion protectedRegion) {
|
||||
if (protectedRegion == null) {
|
||||
return null;
|
||||
}
|
||||
if (createdRegions.containsKey(protectedRegion)) {
|
||||
return createdRegions.get(protectedRegion);
|
||||
}
|
||||
WG7Region wg7Region = new WG7Region(protectedRegion);
|
||||
createdRegions.put(protectedRegion, wg7Region);
|
||||
return wg7Region;
|
||||
}
|
||||
|
||||
public Flag fuzzyMatchFlag(String id) {
|
||||
return Flags.fuzzyMatchFlag(WorldGuard.getInstance().getFlagRegistry(), id);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user