mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Fix armor stand / hangings being considered vehicles
This commit is contained in:
parent
4f0ede646e
commit
b238bdbd21
@ -56,6 +56,8 @@ public class PlotAPI {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public PlotAPI(JavaPlugin plugin) {}
|
public PlotAPI(JavaPlugin plugin) {}
|
||||||
|
|
||||||
|
public PlotAPI(){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all plots.
|
* Get all plots.
|
||||||
*
|
*
|
||||||
|
@ -231,7 +231,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
case ARMOR_STAND:
|
case ARMOR_STAND:
|
||||||
case ITEM_FRAME:
|
case ITEM_FRAME:
|
||||||
case PAINTING:
|
case PAINTING:
|
||||||
// TEMPORARILY CLASSIFY AS VEHICLE
|
// Not vehicles
|
||||||
|
continue;
|
||||||
case MINECART:
|
case MINECART:
|
||||||
case MINECART_CHEST:
|
case MINECART_CHEST:
|
||||||
case MINECART_COMMAND:
|
case MINECART_COMMAND:
|
||||||
|
@ -84,45 +84,45 @@ import java.util.zip.ZipInputStream;
|
|||||||
* An implementation of the core, with a static getter for easy access.
|
* An implementation of the core, with a static getter for easy access.
|
||||||
*/
|
*/
|
||||||
public class PS {
|
public class PS {
|
||||||
|
|
||||||
private static PS instance;
|
private static PS instance;
|
||||||
|
// Implementation
|
||||||
public final IPlotMain IMP;
|
public final IPlotMain IMP;
|
||||||
private final HashSet<Integer> plotAreaHashCheck = new HashSet<>();
|
// Implementation logger
|
||||||
/**
|
private ILogger logger;
|
||||||
* All plot areas mapped by world (quick world access).
|
// Current thread
|
||||||
*/
|
|
||||||
private final HashMap<String, PlotArea[]> plotAreaMap = new HashMap<>();
|
|
||||||
/**
|
|
||||||
* All plot areas mapped by location (quick location based access).
|
|
||||||
*/
|
|
||||||
private final HashMap<String, QuadMap<PlotArea>> plotAreaGrid = new HashMap<>();
|
|
||||||
private final int[] version;
|
|
||||||
private final String platform;
|
|
||||||
private final Thread thread;
|
private final Thread thread;
|
||||||
public HashMap<String, Set<PlotCluster>> clusters_tmp;
|
// Platform / Version / Update URL
|
||||||
public HashMap<String, HashMap<PlotId, Plot>> plots_tmp;
|
private final String platform;
|
||||||
|
private final int[] version;
|
||||||
|
private int[] lastVersion;
|
||||||
|
public URL update;
|
||||||
|
// WorldEdit instance
|
||||||
|
public WorldEdit worldedit;
|
||||||
|
// Files and configuration
|
||||||
|
private File jarFile = null; // This file
|
||||||
public File styleFile;
|
public File styleFile;
|
||||||
public File configFile;
|
public File configFile;
|
||||||
public File worldsFile;
|
public File worldsFile;
|
||||||
public File commandsFile;
|
public File commandsFile;
|
||||||
public File translationFile;
|
public File translationFile;
|
||||||
|
private File storageFile;
|
||||||
public YamlConfiguration style;
|
public YamlConfiguration style;
|
||||||
public YamlConfiguration config;
|
public YamlConfiguration config;
|
||||||
public YamlConfiguration worlds;
|
public YamlConfiguration worlds;
|
||||||
public YamlConfiguration storage;
|
public YamlConfiguration storage;
|
||||||
public YamlConfiguration commands;
|
public YamlConfiguration commands;
|
||||||
public WorldEdit worldedit;
|
// Temporary hold the plots/clusters before the worlds load
|
||||||
public URL update;
|
public HashMap<String, Set<PlotCluster>> clusters_tmp;
|
||||||
private ILogger logger;
|
public HashMap<String, HashMap<PlotId, Plot>> plots_tmp;
|
||||||
private boolean plotAreaHasCollision = false;
|
// All plot areas
|
||||||
/**
|
|
||||||
* All plot areas (quick global access).
|
|
||||||
*/
|
|
||||||
private PlotArea[] plotAreas = new PlotArea[0];
|
private PlotArea[] plotAreas = new PlotArea[0];
|
||||||
private File storageFile;
|
// All plot areas mapped by world
|
||||||
private File file = null; // This file
|
private final HashMap<String, PlotArea[]> plotAreaMap = new HashMap<>();
|
||||||
private int[] lastVersion;
|
// All plot areas mapped by position
|
||||||
private Database database;
|
private final HashMap<String, QuadMap<PlotArea>> plotAreaGrid = new HashMap<>();
|
||||||
|
// Optimization if there are no hash collisions
|
||||||
|
private boolean plotAreaHasCollision = false;
|
||||||
|
private final HashSet<Integer> plotAreaHashCheck = new HashSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize PlotSquared with the desired Implementation class.
|
* Initialize PlotSquared with the desired Implementation class.
|
||||||
@ -140,12 +140,12 @@ public class PS {
|
|||||||
new ReflectionUtils(this.IMP.getNMSPackage());
|
new ReflectionUtils(this.IMP.getNMSPackage());
|
||||||
try {
|
try {
|
||||||
URL url = PS.class.getProtectionDomain().getCodeSource().getLocation();
|
URL url = PS.class.getProtectionDomain().getCodeSource().getLocation();
|
||||||
this.file = new File(new URL(url.toURI().toString().split("\\!")[0].replaceAll("jar:file", "file")).toURI().getPath());
|
this.jarFile = new File(new URL(url.toURI().toString().split("\\!")[0].replaceAll("jar:file", "file")).toURI().getPath());
|
||||||
} catch (MalformedURLException | URISyntaxException | SecurityException e) {
|
} catch (MalformedURLException | URISyntaxException | SecurityException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
this.file = new File(this.IMP.getDirectory().getParentFile(), "PlotSquared.jar");
|
this.jarFile = new File(this.IMP.getDirectory().getParentFile(), "PlotSquared.jar");
|
||||||
if (!this.file.exists()) {
|
if (!this.jarFile.exists()) {
|
||||||
this.file = new File(this.IMP.getDirectory().getParentFile(), "PlotSquared-" + platform + ".jar");
|
this.jarFile = new File(this.IMP.getDirectory().getParentFile(), "PlotSquared-" + platform + ".jar");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getJavaVersion() < 1.8) {
|
if (getJavaVersion() < 1.8) {
|
||||||
@ -452,16 +452,6 @@ public class PS {
|
|||||||
return this.platform;
|
return this.platform;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the {@link Database} object.
|
|
||||||
*
|
|
||||||
* @return the database
|
|
||||||
* @see Database#getConnection() to get the database connection
|
|
||||||
*/
|
|
||||||
public Database getDatabase() {
|
|
||||||
return this.database;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the relevant plot area for a specified location.
|
* Get the relevant plot area for a specified location.
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -1701,7 +1691,7 @@ public class PS {
|
|||||||
|
|
||||||
public boolean update(PlotPlayer sender, URL url) {
|
public boolean update(PlotPlayer sender, URL url) {
|
||||||
try {
|
try {
|
||||||
String name = this.file.getName();
|
String name = this.jarFile.getName();
|
||||||
File newJar = new File("plugins/update/" + name);
|
File newJar = new File("plugins/update/" + name);
|
||||||
MainUtil.sendMessage(sender, "$1Downloading from provided URL: &7" + url);
|
MainUtil.sendMessage(sender, "$1Downloading from provided URL: &7" + url);
|
||||||
URLConnection con = url.openConnection();
|
URLConnection con = url.openConnection();
|
||||||
@ -1748,7 +1738,7 @@ public class PS {
|
|||||||
try (InputStream stream = this.IMP.getClass().getResourceAsStream(file)) {
|
try (InputStream stream = this.IMP.getClass().getResourceAsStream(file)) {
|
||||||
byte[] buffer = new byte[2048];
|
byte[] buffer = new byte[2048];
|
||||||
if (stream == null) {
|
if (stream == null) {
|
||||||
try (ZipInputStream zis = new ZipInputStream(new FileInputStream(this.file))) {
|
try (ZipInputStream zis = new ZipInputStream(new FileInputStream(this.jarFile))) {
|
||||||
ZipEntry ze = zis.getNextEntry();
|
ZipEntry ze = zis.getNextEntry();
|
||||||
while (ze != null) {
|
while (ze != null) {
|
||||||
String name = ze.getName();
|
String name = ze.getName();
|
||||||
@ -1801,8 +1791,6 @@ public class PS {
|
|||||||
*/
|
*/
|
||||||
public void disable() {
|
public void disable() {
|
||||||
try {
|
try {
|
||||||
TaskManager.IMP = null;
|
|
||||||
this.database = null;
|
|
||||||
// Validate that all data in the db is correct
|
// Validate that all data in the db is correct
|
||||||
final HashSet<Plot> plots = new HashSet<>();
|
final HashSet<Plot> plots = new HashSet<>();
|
||||||
foreachPlotRaw(new RunnableVal<Plot>() {
|
foreachPlotRaw(new RunnableVal<Plot>() {
|
||||||
@ -1826,20 +1814,22 @@ public class PS {
|
|||||||
*/
|
*/
|
||||||
public void setupDatabase() {
|
public void setupDatabase() {
|
||||||
try {
|
try {
|
||||||
if (DBFunc.dbManager == null) {
|
if (DBFunc.dbManager != null) {
|
||||||
|
DBFunc.dbManager.close();
|
||||||
|
}
|
||||||
|
Database database;
|
||||||
if (Storage.MySQL.USE) {
|
if (Storage.MySQL.USE) {
|
||||||
this.database = new com.intellectualcrafters.plot.database.MySQL(Storage.MySQL.HOST, Storage.MySQL.PORT, Storage.MySQL.DATABASE,
|
database = new com.intellectualcrafters.plot.database.MySQL(Storage.MySQL.HOST, Storage.MySQL.PORT, Storage.MySQL.DATABASE,
|
||||||
Storage.MySQL.USER, Storage.MySQL.PASSWORD);
|
Storage.MySQL.USER, Storage.MySQL.PASSWORD);
|
||||||
} else if (Storage.SQLite.USE) {
|
} else if (Storage.SQLite.USE) {
|
||||||
File file = MainUtil.getFile(IMP.getDirectory(), Storage.SQLite.DB + ".db");
|
File file = MainUtil.getFile(IMP.getDirectory(), Storage.SQLite.DB + ".db");
|
||||||
this.database = new com.intellectualcrafters.plot.database.SQLite(file);
|
database = new com.intellectualcrafters.plot.database.SQLite(file);
|
||||||
} else {
|
} else {
|
||||||
PS.log(C.PREFIX + "&cNo storage type is set!");
|
PS.log(C.PREFIX + "&cNo storage type is set!");
|
||||||
this.IMP.disable();
|
this.IMP.disable();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
DBFunc.dbManager = new SQLManager(database, Storage.PREFIX, false);
|
||||||
DBFunc.dbManager = new SQLManager(this.database, Storage.PREFIX, false);
|
|
||||||
this.plots_tmp = DBFunc.getPlots();
|
this.plots_tmp = DBFunc.getPlots();
|
||||||
this.clusters_tmp = DBFunc.getClusters();
|
this.clusters_tmp = DBFunc.getClusters();
|
||||||
} catch (ClassNotFoundException | SQLException e) {
|
} catch (ClassNotFoundException | SQLException e) {
|
||||||
|
@ -25,6 +25,8 @@ import java.util.Map.Entry;
|
|||||||
|
|
||||||
public class HybridPlotManager extends ClassicPlotManager {
|
public class HybridPlotManager extends ClassicPlotManager {
|
||||||
|
|
||||||
|
public static boolean REGENERATIVE_CLEAR = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exportTemplate(PlotArea plotArea) throws IOException {
|
public void exportTemplate(PlotArea plotArea) throws IOException {
|
||||||
HashSet<FileBytes> files = new HashSet<>(
|
HashSet<FileBytes> files = new HashSet<>(
|
||||||
@ -146,7 +148,7 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|||||||
Location pos1 = plot.getBottomAbs();
|
Location pos1 = plot.getBottomAbs();
|
||||||
Location pos2 = plot.getExtendedTopAbs();
|
Location pos2 = plot.getExtendedTopAbs();
|
||||||
// If augmented
|
// If augmented
|
||||||
final boolean canRegen = (plotArea.TYPE == 0) && (plotArea.TERRAIN == 0);
|
final boolean canRegen = (plotArea.TYPE == 0) && (plotArea.TERRAIN == 0) && REGENERATIVE_CLEAR;
|
||||||
// The component blocks
|
// The component blocks
|
||||||
final PlotBlock[] plotfloor = dpw.TOP_BLOCK;
|
final PlotBlock[] plotfloor = dpw.TOP_BLOCK;
|
||||||
final PlotBlock[] filling = dpw.MAIN_BLOCK;
|
final PlotBlock[] filling = dpw.MAIN_BLOCK;
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user