mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
fixes
This commit is contained in:
parent
007b9ee298
commit
6044ca63c2
@ -274,7 +274,7 @@ public class PlotHelper {
|
|||||||
SetBlockFast.set(block.getWorld(), block.getX(), block.getY(), block.getZ(), plotblock.id, plotblock.data);
|
SetBlockFast.set(block.getWorld(), block.getX(), block.getY(), block.getZ(), plotblock.id, plotblock.data);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (NoSuchMethodException e) {
|
catch (Throwable e) {
|
||||||
canSetFast = false;
|
canSetFast = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -733,10 +733,8 @@ public class PlotMain extends JavaPlugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get MySQL Connection
|
* Get MySQL Connection
|
||||||
*
|
|
||||||
* @return connection MySQL Connection.
|
* @return connection MySQL Connection.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public static Connection getConnection() {
|
public static Connection getConnection() {
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
@ -959,7 +957,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static void killAllEntities() {
|
public static void killAllEntities() {
|
||||||
Bukkit.getScheduler().scheduleAsyncRepeatingTask(getMain(), new Runnable() {
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(getMain(), new Runnable() {
|
||||||
Location location;
|
Location location;
|
||||||
long ticked = 0l;
|
long ticked = 0l;
|
||||||
long error = 0l;
|
long error = 0l;
|
||||||
@ -986,73 +984,72 @@ public class PlotMain extends JavaPlugin {
|
|||||||
Entity[] entities = chunk.getEntities();
|
Entity[] entities = chunk.getEntities();
|
||||||
for (int i = entities.length - 1; i >= 0; i--) {
|
for (int i = entities.length - 1; i >= 0; i--) {
|
||||||
Entity entity = entities[i];
|
Entity entity = entities[i];
|
||||||
|
|
||||||
if ((entity instanceof Player) || PlayerEvents.isInPlot(entity.getLocation())) {
|
if ((entity instanceof Player) || PlayerEvents.isInPlot(entity.getLocation())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean tamed = false;
|
|
||||||
if (Settings.MOB_PATHFINDING) {
|
|
||||||
if (entity instanceof Tameable) {
|
|
||||||
Tameable tameable = (Tameable) entity;
|
|
||||||
if (tameable.isTamed()) {
|
|
||||||
tamed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (entity instanceof LivingEntity) {
|
|
||||||
LivingEntity livingEntity = ((LivingEntity) entity);
|
|
||||||
if (livingEntity.getCustomName() != null) {
|
|
||||||
tamed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!tamed) {
|
|
||||||
entity.remove();
|
entity.remove();
|
||||||
continue;
|
// boolean tamed = false;
|
||||||
}
|
// if (Settings.MOB_PATHFINDING) {
|
||||||
boolean found = false;
|
// if (entity instanceof Tameable) {
|
||||||
int radius = 1;
|
// Tameable tameable = (Tameable) entity;
|
||||||
int dir = 0;
|
// if (tameable.isTamed()) {
|
||||||
int x = this.location.getBlockX();
|
// tamed = true;
|
||||||
int y = this.location.getBlockY();
|
// }
|
||||||
int z = this.location.getBlockZ();
|
// }
|
||||||
while (!found && (radius < 4)) {
|
// else
|
||||||
Location pos;
|
// if (entity instanceof LivingEntity) {
|
||||||
switch (dir) {
|
// LivingEntity livingEntity = ((LivingEntity) entity);
|
||||||
case 0:
|
// if (livingEntity.getCustomName() != null) {
|
||||||
pos = new Location(world, x + radius, y, z);
|
// tamed = true;
|
||||||
dir++;
|
// }
|
||||||
break;
|
// }
|
||||||
case 1:
|
// if (!tamed) {
|
||||||
pos = new Location(world, x, y, z + radius);
|
// entity.remove();
|
||||||
dir++;
|
// continue;
|
||||||
break;
|
// }
|
||||||
case 2:
|
// boolean found = false;
|
||||||
pos = new Location(world, x - radius, y, z);
|
// int radius = 1;
|
||||||
dir++;
|
// int dir = 0;
|
||||||
break;
|
// int x = this.location.getBlockX();
|
||||||
case 3:
|
// int y = this.location.getBlockY();
|
||||||
pos = new Location(world, x, y, z - radius);
|
// int z = this.location.getBlockZ();
|
||||||
dir = 0;
|
// while (!found && (radius < 4)) {
|
||||||
radius++;
|
// Location pos;
|
||||||
break;
|
// switch (dir) {
|
||||||
default:
|
// case 0:
|
||||||
pos = this.location;
|
// pos = new Location(world, x + radius, y, z);
|
||||||
break;
|
// dir++;
|
||||||
|
// break;
|
||||||
}
|
// case 1:
|
||||||
if (PlayerEvents.isInPlot(pos)) {
|
// pos = new Location(world, x, y, z + radius);
|
||||||
entity.teleport(pos.add(0.5, 0, 0.5));
|
// dir++;
|
||||||
found = true;
|
// break;
|
||||||
break;
|
// case 2:
|
||||||
}
|
// pos = new Location(world, x - radius, y, z);
|
||||||
}
|
// dir++;
|
||||||
entity.teleport(this.location.subtract(this.location.getDirection().normalize().multiply(2)));
|
// break;
|
||||||
|
// case 3:
|
||||||
|
// pos = new Location(world, x, y, z - radius);
|
||||||
|
// dir = 0;
|
||||||
|
// radius++;
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// pos = this.location;
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// if (PlayerEvents.isInPlot(pos)) {
|
||||||
|
// entity.teleport(pos.add(0.5, 0, 0.5));
|
||||||
|
// found = true;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// entity.teleport(this.location.subtract(this.location.getDirection().normalize().multiply(2)));
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
catch (Throwable e) {
|
||||||
catch (Exception e) {
|
|
||||||
++this.error;
|
++this.error;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
@ -1060,7 +1057,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 0l, 2l);
|
}, 2L, 2L);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1083,6 +1080,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
options.put("schematics.save_path", Settings.SCHEMATIC_SAVE_PATH);
|
options.put("schematics.save_path", Settings.SCHEMATIC_SAVE_PATH);
|
||||||
options.put("api.location", Settings.API_URL);
|
options.put("api.location", Settings.API_URL);
|
||||||
options.put("api.custom", Settings.CUSTOM_API);
|
options.put("api.custom", Settings.CUSTOM_API);
|
||||||
|
options.put("titles", Settings.TITLES);
|
||||||
|
|
||||||
for (Entry<String, Object> node : options.entrySet()) {
|
for (Entry<String, Object> node : options.entrySet()) {
|
||||||
if (!config.contains(node.getKey())) {
|
if (!config.contains(node.getKey())) {
|
||||||
@ -1099,6 +1097,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
Settings.METRICS = config.getBoolean("metrics");
|
Settings.METRICS = config.getBoolean("metrics");
|
||||||
Settings.AUTO_CLEAR_DAYS = config.getInt("clear.auto.days");
|
Settings.AUTO_CLEAR_DAYS = config.getInt("clear.auto.days");
|
||||||
Settings.AUTO_CLEAR = config.getBoolean("clear.auto.enabled");
|
Settings.AUTO_CLEAR = config.getBoolean("clear.auto.enabled");
|
||||||
|
Settings.TITLES = config.getBoolean("titles");
|
||||||
Settings.MAX_PLOTS = config.getInt("max_plots");
|
Settings.MAX_PLOTS = config.getInt("max_plots");
|
||||||
Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path");
|
Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path");
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ package com.intellectualcrafters.plot;
|
|||||||
* @author Empire92
|
* @author Empire92
|
||||||
*/
|
*/
|
||||||
public class Settings {
|
public class Settings {
|
||||||
|
public static boolean TITLES = true;
|
||||||
/**
|
/**
|
||||||
* Schematic Save Path
|
* Schematic Save Path
|
||||||
*/
|
*/
|
||||||
|
@ -14,6 +14,7 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.C;
|
import com.intellectualcrafters.plot.C;
|
||||||
|
import com.intellectualcrafters.plot.FlagManager;
|
||||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.Plot;
|
import com.intellectualcrafters.plot.Plot;
|
||||||
import com.intellectualcrafters.plot.PlotHelper;
|
import com.intellectualcrafters.plot.PlotHelper;
|
||||||
@ -108,40 +109,21 @@ public class Auto extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean br = false;
|
boolean br = false;
|
||||||
int x = 0, z = 0, q = 100;
|
|
||||||
PlotId id;
|
|
||||||
if ((size_x == 1) && (size_z == 1)) {
|
if ((size_x == 1) && (size_z == 1)) {
|
||||||
while (!br) {
|
while (!br) {
|
||||||
Plot plot = PlotHelper.getPlot(world, Auto.lastPlot);
|
Plot plot = PlotHelper.getPlot(world, Auto.lastPlot);
|
||||||
if (plot==null || plot.owner == null) {
|
if (plot==null || plot.owner == null) {
|
||||||
plot = PlotHelper.getPlot(world, Auto.lastPlot);
|
plot = PlotHelper.getPlot(world, Auto.lastPlot);
|
||||||
boolean result = Claim.claimPlot(plr, plot, true);
|
Claim.claimPlot(plr, plot, true);
|
||||||
br = !result;
|
br = true;
|
||||||
|
PlotWorld pw = PlotMain.getWorldSettings(world);
|
||||||
|
Plot plot2 = PlotMain.getPlots(world).get(plot.id);
|
||||||
|
if (pw.DEFAULT_FLAGS != null && pw.DEFAULT_FLAGS.size() > 0) {
|
||||||
|
plot2.settings.setFlags(FlagManager.parseFlags(pw.DEFAULT_FLAGS));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Auto.lastPlot = getNextPlot(Auto.lastPlot, 1);
|
Auto.lastPlot = getNextPlot(Auto.lastPlot, 1);
|
||||||
}
|
}
|
||||||
while (!br) {
|
|
||||||
id = new PlotId(x, z);
|
|
||||||
if (PlotHelper.getPlot(world, id).owner == null) {
|
|
||||||
Plot plot = PlotHelper.getPlot(world, id);
|
|
||||||
boolean result = Claim.claimPlot(plr, plot, true);
|
|
||||||
br = !result;
|
|
||||||
}
|
|
||||||
if ((z < q) && ((z - x) < q)) {
|
|
||||||
z++;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (x < q) {
|
|
||||||
x++;
|
|
||||||
z = q - 100;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
q += 100;
|
|
||||||
x = q;
|
|
||||||
z = q;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
boolean claimed = true;
|
boolean claimed = true;
|
||||||
@ -168,6 +150,11 @@ public class Auto extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
br = true;
|
br = true;
|
||||||
|
PlotWorld pw = PlotMain.getWorldSettings(world);
|
||||||
|
Plot plot2 = PlotMain.getPlots(world).get(start);
|
||||||
|
if (pw.DEFAULT_FLAGS != null && pw.DEFAULT_FLAGS.size() > 0) {
|
||||||
|
plot2.settings.setFlags(FlagManager.parseFlags(pw.DEFAULT_FLAGS));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,6 +99,9 @@ public class Claim extends SubCommand {
|
|||||||
PlotMain.teleportPlayer(player, player.getLocation(), plot);
|
PlotMain.teleportPlayer(player, player.getLocation(), plot);
|
||||||
}
|
}
|
||||||
PlotWorld world = PlotMain.getWorldSettings(plot.getWorld());
|
PlotWorld world = PlotMain.getWorldSettings(plot.getWorld());
|
||||||
|
|
||||||
|
Plot plot2 = PlotMain.getPlots(player.getWorld()).get(plot.id);
|
||||||
|
|
||||||
if (world.SCHEMATIC_ON_CLAIM) {
|
if (world.SCHEMATIC_ON_CLAIM) {
|
||||||
SchematicHandler.Schematic sch;
|
SchematicHandler.Schematic sch;
|
||||||
if (schematic.equals("")) {
|
if (schematic.equals("")) {
|
||||||
@ -110,10 +113,10 @@ public class Claim extends SubCommand {
|
|||||||
sch = SchematicHandler.getSchematic(world.SCHEMATIC_FILE);
|
sch = SchematicHandler.getSchematic(world.SCHEMATIC_FILE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SchematicHandler.paste(player.getLocation(), sch, plot, 0, 0);
|
SchematicHandler.paste(player.getLocation(), sch, plot2, 0, 0);
|
||||||
}
|
}
|
||||||
if (world.DEFAULT_FLAGS != null && world.DEFAULT_FLAGS.size() > 0) {
|
if (world.DEFAULT_FLAGS != null && world.DEFAULT_FLAGS.size() > 0) {
|
||||||
plot.settings.setFlags(FlagManager.parseFlags(PlotMain.getWorldSettings(player.getWorld()).DEFAULT_FLAGS));
|
plot2.settings.setFlags(FlagManager.parseFlags(world.DEFAULT_FLAGS));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return event.isCancelled();
|
return event.isCancelled();
|
||||||
|
@ -23,7 +23,7 @@ import com.intellectualcrafters.plot.database.DBFunc;
|
|||||||
public class Purge extends SubCommand {
|
public class Purge extends SubCommand {
|
||||||
|
|
||||||
public Purge() {
|
public Purge() {
|
||||||
super("purge", "plots.admin", "Purge all plots for a world", "purge", "", CommandCategory.ACTIONS, false);
|
super("purge", "plots.admin", "Purge all plots for a world", "purge", "", CommandCategory.DEBUG, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -67,7 +67,7 @@ public class Visit extends SubCommand {
|
|||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_NUMBER);
|
PlayerFunctions.sendMessage(plr, C.NOT_VALID_NUMBER);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ((i < 0) || (i > plots.size())) {
|
if ((i < 0) || (i >= plots.size())) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_NUMBER);
|
PlayerFunctions.sendMessage(plr, C.NOT_VALID_NUMBER);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -439,7 +439,7 @@ public class SQLManager extends AbstractDB {
|
|||||||
user = UUID.fromString(o);
|
user = UUID.fromString(o);
|
||||||
uuids.put(o, user);
|
uuids.put(o, user);
|
||||||
}
|
}
|
||||||
p = new Plot(plot_id, user, Biome.FOREST, new ArrayList<UUID>(), new ArrayList<UUID>(), new ArrayList<UUID>(), "", PlotHomePosition.DEFAULT, null, worldname, new boolean[0]);
|
p = new Plot(plot_id, user, Biome.FOREST, new ArrayList<UUID>(), new ArrayList<UUID>(), new ArrayList<UUID>(), "", PlotHomePosition.DEFAULT, null, worldname, new boolean[] {false, false, false, false});
|
||||||
plots.put(id, p);
|
plots.put(id, p);
|
||||||
}
|
}
|
||||||
stmt.close();
|
stmt.close();
|
||||||
|
@ -77,6 +77,7 @@ public class ForceFieldListener implements Listener {
|
|||||||
if(!PlayerFunctions.isInPlot(player))
|
if(!PlayerFunctions.isInPlot(player))
|
||||||
return;
|
return;
|
||||||
Plot plot = PlayerFunctions.getCurrentPlot(player);
|
Plot plot = PlayerFunctions.getCurrentPlot(player);
|
||||||
|
if (plot.settings.getFlag("forcefield") != null && plot.settings.getFlag("forcefield").getValue().equals("true")) {
|
||||||
if(!PlotListener.booleanFlag(plot, "forcefield"))
|
if(!PlotListener.booleanFlag(plot, "forcefield"))
|
||||||
if(plot.hasRights(player)) {
|
if(plot.hasRights(player)) {
|
||||||
Set<Player> players = getNearbyPlayers(player, plot);
|
Set<Player> players = getNearbyPlayers(player, plot);
|
||||||
@ -90,3 +91,4 @@ public class ForceFieldListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
@ -176,7 +176,7 @@ public class PlotListener {
|
|||||||
if(plot.settings.getFlag("weather") != null) {
|
if(plot.settings.getFlag("weather") != null) {
|
||||||
player.setPlayerWeather(getWeatherType(plot.settings.getFlag("weather").getValue()));
|
player.setPlayerWeather(getWeatherType(plot.settings.getFlag("weather").getValue()));
|
||||||
}
|
}
|
||||||
if (C.TITLE_ENTERED_PLOT.s().length() > 2) {
|
if (Settings.TITLES && C.TITLE_ENTERED_PLOT.s().length() > 2) {
|
||||||
String sTitleMain = C.TITLE_ENTERED_PLOT.s().replaceFirst("%s", plot.getDisplayName());
|
String sTitleMain = C.TITLE_ENTERED_PLOT.s().replaceFirst("%s", plot.getDisplayName());
|
||||||
String sTitleSub = C.TITLE_ENTERED_PLOT_SUB.s().replaceFirst("%s", getName(plot.owner));
|
String sTitleSub = C.TITLE_ENTERED_PLOT_SUB.s().replaceFirst("%s", getName(plot.owner));
|
||||||
ChatColor sTitleMainColor = ChatColor.valueOf(C.TITLE_ENTERED_PLOT_COLOR.s());
|
ChatColor sTitleMainColor = ChatColor.valueOf(C.TITLE_ENTERED_PLOT_COLOR.s());
|
||||||
|
Loading…
Reference in New Issue
Block a user