mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Merge branch 'master' into breaking
# Conflicts: # Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotRateEvent.java # Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEventUtil.java # Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java # Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java # Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java # Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java # Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java # Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java # Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java # Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java # Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java # Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Reload.java # Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java # Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java # Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java # Core/src/main/java/com/intellectualcrafters/plot/commands/Clear.java # Core/src/main/java/com/intellectualcrafters/plot/commands/PluginCmd.java # Core/src/main/java/com/intellectualcrafters/plot/commands/Relight.java # Core/src/main/java/com/intellectualcrafters/plot/commands/SetHome.java # Core/src/main/java/com/intellectualcrafters/plot/config/C.java # Core/src/main/java/com/intellectualcrafters/plot/config/Configuration.java # Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java # Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/EventUtilTest.java # Nukkit/src/main/java/com/plotsquared/nukkit/util/NukkitEventUtil.java # README.md # Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/events/PlotRateEvent.java # Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/SpongeSchematicHandler.java # Sponge/src/main/java/com/github/intellectualsites/plotsquared/sponge/util/block/SpongeLocalQueue.java # Sponge/src/main/java/com/plotsquared/sponge/util/SpongeEventUtil.java
This commit is contained in:
@ -56,8 +56,7 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils
|
||||
|
||||
public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
|
||||
@Getter
|
||||
private static WorldEdit worldEdit;
|
||||
@Getter private static WorldEdit worldEdit;
|
||||
private static Map<String, Plugin> pluginMap;
|
||||
|
||||
static {
|
||||
@ -125,7 +124,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
PlotSquared.debug(StringMan.getString(Bukkit.getBukkitVersion()));
|
||||
PlotSquared.debug(StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\.")));
|
||||
PlotSquared.debug(
|
||||
StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\.")));
|
||||
return new int[] {1, 13, 0};
|
||||
}
|
||||
}
|
||||
@ -451,7 +451,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
Entity passenger = entity.getPassenger();
|
||||
if (!(passenger instanceof Player) && entity
|
||||
.getMetadata("keep").isEmpty()) {
|
||||
if (entity.hasMetadata("ps-tmp-teleport")) {
|
||||
if (entity
|
||||
.hasMetadata("ps-tmp-teleport")) {
|
||||
continue;
|
||||
}
|
||||
iterator.remove();
|
||||
@ -502,7 +503,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
&& (currentPlotId == null || !area
|
||||
.getPlot(originalPlotId)
|
||||
.equals(area.getPlot(currentPlotId)))) {
|
||||
if (entity.hasMetadata("ps-tmp-teleport")) {
|
||||
if (entity
|
||||
.hasMetadata("ps-tmp-teleport")) {
|
||||
continue;
|
||||
}
|
||||
iterator.remove();
|
||||
@ -540,12 +542,13 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
}, 20);
|
||||
}
|
||||
|
||||
@Override @Nullable public final ChunkGenerator getDefaultWorldGenerator(final String world, final String id) {
|
||||
@Override @Nullable
|
||||
public final ChunkGenerator getDefaultWorldGenerator(final String world, final String id) {
|
||||
if (Settings.Enabled_Components.PLOTME_CONVERTER) {
|
||||
initPlotMeConverter();
|
||||
Settings.Enabled_Components.PLOTME_CONVERTER = false;
|
||||
}
|
||||
final IndependentPlotGenerator result;
|
||||
final IndependentPlotGenerator result;
|
||||
if (id != null && id.equalsIgnoreCase("single")) {
|
||||
result = new SingleWorldGenerator();
|
||||
} else {
|
||||
@ -671,7 +674,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override @Nullable public GeneratorWrapper<?> getGenerator(@NonNull final String world, @Nullable final String name) {
|
||||
@Override @Nullable public GeneratorWrapper<?> getGenerator(@NonNull final String world,
|
||||
@Nullable final String name) {
|
||||
if (name == null) {
|
||||
return null;
|
||||
}
|
||||
@ -854,8 +858,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratorWrapper<?> wrapPlotGenerator(@Nullable final String world, @NonNull final IndependentPlotGenerator generator) {
|
||||
@Override public GeneratorWrapper<?> wrapPlotGenerator(@Nullable final String world,
|
||||
@NonNull final IndependentPlotGenerator generator) {
|
||||
return new BukkitPlotGenerator(generator);
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,8 @@ public class FancyMessage
|
||||
// Assume composite type
|
||||
// The only composite type we currently store is another FancyMessage
|
||||
// Therefore, recursion time!
|
||||
component.hoverActionData = deserialize(object.get("value").toString() /* This should properly serialize the JSON object as a JSON string */);
|
||||
component.hoverActionData = deserialize(object.get("value")
|
||||
.toString() /* This should properly serialize the JSON object as a JSON string */);
|
||||
}
|
||||
} else if (entry.getKey().equals("insertion")) {
|
||||
component.insertionData = entry.getValue().getAsString();
|
||||
@ -622,8 +623,7 @@ public class FancyMessage
|
||||
* @return This builder instance.
|
||||
*/
|
||||
public FancyMessage formattedTooltip(final Iterable<FancyMessage> lines) {
|
||||
return formattedTooltip(
|
||||
ArrayWrapper.toArray(lines, FancyMessage.class));
|
||||
return formattedTooltip(ArrayWrapper.toArray(lines, FancyMessage.class));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -664,8 +664,7 @@ public class FancyMessage
|
||||
* @return This builder instance.
|
||||
*/
|
||||
public FancyMessage translationReplacements(final Iterable<FancyMessage> replacements) {
|
||||
return translationReplacements(
|
||||
ArrayWrapper.toArray(replacements, FancyMessage.class));
|
||||
return translationReplacements(ArrayWrapper.toArray(replacements, FancyMessage.class));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,7 +48,7 @@ public abstract class TextualComponent implements Cloneable {
|
||||
|
||||
/**
|
||||
* Create a textual component representing a string literal.
|
||||
* <p>
|
||||
*
|
||||
* <p>This is the default type of textual component when a single string
|
||||
* literal is given to a method.
|
||||
*
|
||||
@ -98,7 +98,7 @@ public abstract class TextualComponent implements Cloneable {
|
||||
/**
|
||||
* Create a textual component representing a scoreboard value.
|
||||
* The client will see the score of the specified player for the specified objective as the text represented by this component.
|
||||
* <p>
|
||||
*
|
||||
* <p><b>This method is currently guaranteed to throw an {@code UnsupportedOperationException}
|
||||
* as it is only supported on snapshot clients.</b>
|
||||
*
|
||||
@ -234,7 +234,7 @@ public abstract class TextualComponent implements Cloneable {
|
||||
/**
|
||||
* Internal class used to represent a text component with a nested JSON
|
||||
* value.
|
||||
* <p>
|
||||
*
|
||||
* <p>Exception validating done is on keys and values.
|
||||
*/
|
||||
private static final class ComplexTextTypeComponent extends TextualComponent
|
||||
|
@ -113,8 +113,8 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
}
|
||||
}
|
||||
if (name.isEmpty()) {
|
||||
PlotSquared
|
||||
.log("&cCould not identify owner for plot: " + id + " -> '" + name + "'");
|
||||
PlotSquared.log(
|
||||
"&cCould not identify owner for plot: " + id + " -> '" + name + "'");
|
||||
missing++;
|
||||
continue;
|
||||
}
|
||||
@ -129,8 +129,10 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
}
|
||||
if (missing > 0) {
|
||||
PlotSquared.log("&cSome names could not be identified:");
|
||||
PlotSquared.log("&7 - Empty quotes mean PlotMe just stored an unowned plot in the database");
|
||||
PlotSquared.log("&7 - Names you have never seen before could be from people mistyping commands");
|
||||
PlotSquared
|
||||
.log("&7 - Empty quotes mean PlotMe just stored an unowned plot in the database");
|
||||
PlotSquared.log(
|
||||
"&7 - Names you have never seen before could be from people mistyping commands");
|
||||
PlotSquared.log(
|
||||
"&7 - Converting from a non-uuid version of PlotMe can't identify owners if the playerdata files are deleted (these plots will "
|
||||
+ "remain unknown until the player connects)");
|
||||
@ -232,7 +234,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
}
|
||||
|
||||
@Override public boolean accepts(String version) {
|
||||
return version == null || PlotSquared.get().canUpdate(version, "0.17.0") || PlotSquared.get()
|
||||
.canUpdate("0.999.999", version);
|
||||
return version == null || PlotSquared.get().canUpdate(version, "0.17.0") || PlotSquared
|
||||
.get().canUpdate("0.999.999", version);
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,8 @@ public class LikePlotMeConverter {
|
||||
}
|
||||
|
||||
private void sendMessage(String message) {
|
||||
PlotSquared.debug("&3PlotMe&8->&3" + PlotSquared.imp().getPluginName() + "&8: &7" + message);
|
||||
PlotSquared
|
||||
.debug("&3PlotMe&8->&3" + PlotSquared.imp().getPluginName() + "&8: &7" + message);
|
||||
}
|
||||
|
||||
public String getPlotMePath() {
|
||||
@ -126,7 +127,8 @@ public class LikePlotMeConverter {
|
||||
PlotSquared.get().worlds.set("worlds." + world + ".wall.block_claimed", claimed);
|
||||
String floor =
|
||||
plotmeDgYml.getString("worlds." + plotMeWorldName + ".PlotFloorBlock", "2"); //
|
||||
PlotSquared.get().worlds.set("worlds." + world + ".plot.floor", Collections.singletonList(floor));
|
||||
PlotSquared.get().worlds
|
||||
.set("worlds." + world + ".plot.floor", Collections.singletonList(floor));
|
||||
String filling = plotmeDgYml.getString("worlds." + plotMeWorldName + ".FillBlock", "3"); //
|
||||
PlotSquared.get().worlds
|
||||
.set("worlds." + world + ".plot.filling", Collections.singletonList(filling));
|
||||
@ -330,8 +332,8 @@ public class LikePlotMeConverter {
|
||||
// load world with MV
|
||||
Bukkit.getServer()
|
||||
.dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
||||
"mv import " + actualWorldName + " normal -g " + PlotSquared
|
||||
.imp().getPluginName());
|
||||
"mv import " + actualWorldName + " normal -g "
|
||||
+ PlotSquared.imp().getPluginName());
|
||||
} else if (mw) {
|
||||
// unload world with MW
|
||||
Bukkit.getServer()
|
||||
@ -345,15 +347,15 @@ public class LikePlotMeConverter {
|
||||
// load world with MW
|
||||
Bukkit.getServer()
|
||||
.dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
||||
"mw create " + actualWorldName + " plugin:" + PlotSquared
|
||||
.imp()
|
||||
.getPluginName());
|
||||
"mw create " + actualWorldName + " plugin:"
|
||||
+ PlotSquared.imp().getPluginName());
|
||||
} else {
|
||||
// Load using Bukkit API
|
||||
// - User must set generator manually
|
||||
Bukkit.getServer().unloadWorld(world, true);
|
||||
World myWorld = WorldCreator.name(actualWorldName).generator(
|
||||
new BukkitPlotGenerator(PlotSquared.get().IMP.getDefaultGenerator()))
|
||||
new BukkitPlotGenerator(
|
||||
PlotSquared.get().IMP.getDefaultGenerator()))
|
||||
.createWorld();
|
||||
myWorld.save();
|
||||
}
|
||||
|
@ -58,7 +58,8 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
PlotSquared.debug("=======================================");
|
||||
PlotSquared.debug(
|
||||
"&8 - &7The database does not match the version specified in the PlotMe config");
|
||||
PlotSquared.debug("&8 - &7Please correct this, or if you are unsure, the most common is 0.16.3");
|
||||
PlotSquared.debug(
|
||||
"&8 - &7Please correct this, or if you are unsure, the most common is 0.16.3");
|
||||
return null;
|
||||
}
|
||||
boolean checkUUID = DBFunc.hasColumn(resultSet, "ownerID");
|
||||
@ -142,7 +143,8 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
int key = resultSet.getInt("plot_id");
|
||||
Plot plot = plots.get(key);
|
||||
if (plot == null) {
|
||||
PlotSquared.log("&6Denied (" + key + ") references deleted plot; ignoring entry.");
|
||||
PlotSquared
|
||||
.log("&6Denied (" + key + ") references deleted plot; ignoring entry.");
|
||||
continue;
|
||||
}
|
||||
String player = resultSet.getString("player");
|
||||
@ -159,7 +161,8 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
int key = resultSet.getInt("plot_id");
|
||||
Plot plot = plots.get(key);
|
||||
if (plot == null) {
|
||||
PlotSquared.log("&6Allowed (" + key + ") references deleted plot; ignoring entry.");
|
||||
PlotSquared
|
||||
.log("&6Allowed (" + key + ") references deleted plot; ignoring entry.");
|
||||
continue;
|
||||
}
|
||||
String player = resultSet.getString("player");
|
||||
|
@ -0,0 +1,105 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.events;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class PlotChangeOwnerEvent extends PlotEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final Player initiator;
|
||||
private final UUID newOwner;
|
||||
private final UUID oldOwner;
|
||||
private boolean hasOldOwner;
|
||||
private boolean cancelled;
|
||||
|
||||
/**
|
||||
* PlotChangeOwnerEvent: Called when a plot's owner is change.
|
||||
*
|
||||
* @param newOwner The new owner of the plot
|
||||
* @param oldOwner The old owner of the plot
|
||||
* @param plot The plot having its owner changed
|
||||
*/
|
||||
public PlotChangeOwnerEvent(Player initiator, Plot plot, UUID oldOwner, UUID newOwner,
|
||||
boolean hasOldOwner) {
|
||||
super(plot);
|
||||
this.initiator = initiator;
|
||||
this.newOwner = newOwner;
|
||||
this.oldOwner = oldOwner;
|
||||
this.hasOldOwner = hasOldOwner;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PlotId.
|
||||
*
|
||||
* @return PlotId
|
||||
*/
|
||||
public PlotId getPlotId() {
|
||||
return getPlot().getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the world name.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public String getWorld() {
|
||||
return getPlot().getWorldName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the change-owner initator
|
||||
*
|
||||
* @return Player
|
||||
*/
|
||||
public Player getInitiator() {
|
||||
return this.initiator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the old owner of the plot. Null if not exists.
|
||||
*
|
||||
* @return UUID
|
||||
*/
|
||||
public UUID getOldOwner() {
|
||||
return this.oldOwner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the new owner of the plot
|
||||
*
|
||||
* @return UUID
|
||||
*/
|
||||
public UUID getNewOwner() {
|
||||
return this.newOwner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get if the plot had an old owner
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean hasOldOwner() {
|
||||
return this.hasOldOwner;
|
||||
}
|
||||
|
||||
@Override public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
@Override public void setCancelled(boolean b) {
|
||||
this.cancelled = b;
|
||||
}
|
||||
}
|
@ -3,13 +3,15 @@ package com.github.intellectualsites.plotsquared.bukkit.events;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Rating;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class PlotRateEvent extends PlotEvent {
|
||||
public class PlotRateEvent extends PlotEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final PlotPlayer rater;
|
||||
private Rating rating;
|
||||
private boolean cancelled = false;
|
||||
|
||||
public PlotRateEvent(PlotPlayer rater, Rating rating, Plot plot) {
|
||||
super(plot);
|
||||
@ -37,4 +39,11 @@ public class PlotRateEvent extends PlotEvent {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
@Override public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +117,8 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
|
||||
@Override
|
||||
public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) {
|
||||
return PlotSquared.get().IMP.getDefaultGenerator().getNewPlotArea(world, id, min, max);
|
||||
return PlotSquared.get().IMP.getDefaultGenerator()
|
||||
.getNewPlotArea(world, id, min, max);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -226,7 +226,8 @@ public class ChunkListener implements Listener {
|
||||
if (!chunk.isLoaded()) {
|
||||
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
||||
TaskManager.tasks.remove(currentIndex);
|
||||
PlotSquared.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
|
||||
PlotSquared
|
||||
.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
|
||||
chunk.unload(true, true);
|
||||
return;
|
||||
}
|
||||
@ -234,7 +235,8 @@ public class ChunkListener implements Listener {
|
||||
if (tiles.length == 0) {
|
||||
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
||||
TaskManager.tasks.remove(currentIndex);
|
||||
PlotSquared.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
|
||||
PlotSquared
|
||||
.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
|
||||
chunk.unload(true, true);
|
||||
return;
|
||||
}
|
||||
@ -244,7 +246,8 @@ public class ChunkListener implements Listener {
|
||||
if (i >= tiles.length) {
|
||||
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
||||
TaskManager.tasks.remove(currentIndex);
|
||||
PlotSquared.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
|
||||
PlotSquared
|
||||
.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
|
||||
chunk.unload(true, true);
|
||||
return;
|
||||
}
|
||||
@ -268,15 +271,15 @@ public class ChunkListener implements Listener {
|
||||
ent.remove();
|
||||
}
|
||||
}
|
||||
PlotSquared
|
||||
.debug(C.PREFIX.s() + "&a detected unsafe chunk and processed: " + (chunk.getX() << 4)
|
||||
+ "," + (chunk.getX() << 4));
|
||||
PlotSquared.debug(
|
||||
C.PREFIX.s() + "&a detected unsafe chunk and processed: " + (chunk.getX() << 4)
|
||||
+ "," + (chunk.getX() << 4));
|
||||
}
|
||||
if (tiles.length > Settings.Chunk_Processor.MAX_TILES) {
|
||||
if (unload) {
|
||||
PlotSquared
|
||||
.debug(C.PREFIX.s() + "&c detected unsafe chunk: " + (chunk.getX() << 4) + "," + (
|
||||
chunk.getX() << 4));
|
||||
PlotSquared.debug(
|
||||
C.PREFIX.s() + "&c detected unsafe chunk: " + (chunk.getX() << 4) + "," + (
|
||||
chunk.getX() << 4));
|
||||
cleanChunk(chunk);
|
||||
return true;
|
||||
}
|
||||
|
@ -909,8 +909,10 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onChat(AsyncPlayerChatEvent event) {
|
||||
@EventHandler(priority = EventPriority.LOW) public void onChat(AsyncPlayerChatEvent event) {
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
PlotPlayer plotPlayer = BukkitUtil.getPlayer(event.getPlayer());
|
||||
Location location = plotPlayer.getLocation();
|
||||
PlotArea area = location.getPlotArea();
|
||||
@ -2100,7 +2102,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
|
||||
entity.setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot));
|
||||
entity
|
||||
.setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2332,7 +2335,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
@SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
|
||||
EntityDamageByEntityEvent eventChange = null;
|
||||
if (PlotSquared.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_11_0)) {
|
||||
if (PlotSquared.get()
|
||||
.checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_11_0)) {
|
||||
eventChange = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(),
|
||||
EntityDamageEvent.DamageCause.FIRE_TICK, (double) event.getDuration());
|
||||
} else {
|
||||
|
@ -42,7 +42,8 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
HumanEntity entity = event.getWhoClicked();
|
||||
if (!(entity instanceof Player) || !PlotSquared.get().hasPlotArea(entity.getWorld().getName())) {
|
||||
if (!(entity instanceof Player) || !PlotSquared.get()
|
||||
.hasPlotArea(entity.getWorld().getName())) {
|
||||
return;
|
||||
}
|
||||
Player player = (Player) entity;
|
||||
|
@ -7,18 +7,15 @@ import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
@Getter
|
||||
public abstract class EntityWrapper {
|
||||
|
||||
private final Entity entity;
|
||||
private final EntityType type;
|
||||
|
||||
public double x;
|
||||
public double y;
|
||||
public double z;
|
||||
@Getter public abstract class EntityWrapper {
|
||||
|
||||
protected final float yaw;
|
||||
protected final float pitch;
|
||||
private final Entity entity;
|
||||
private final EntityType type;
|
||||
public double x;
|
||||
public double y;
|
||||
public double z;
|
||||
|
||||
EntityWrapper(@NonNull final Entity entity) {
|
||||
this.entity = entity;
|
||||
|
@ -53,7 +53,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
if (depth == 1) {
|
||||
return;
|
||||
}
|
||||
if (PlotSquared.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_10_0)
|
||||
if (PlotSquared.get()
|
||||
.checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_10_0)
|
||||
|| entity instanceof ArmorStand) {
|
||||
if (!entity.hasGravity()) {
|
||||
this.noGravity = true;
|
||||
@ -62,8 +63,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
switch (entity.getType()) {
|
||||
case ARROW:
|
||||
case BOAT:
|
||||
if (PlotSquared
|
||||
.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||
if (PlotSquared.get()
|
||||
.checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||
Boat boat = (Boat) entity;
|
||||
this.dataByte = getOrdinal(TreeSpecies.values(), boat.getWoodType());
|
||||
}
|
||||
@ -188,8 +189,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
storeLiving((LivingEntity) entity);
|
||||
return;
|
||||
case SKELETON:
|
||||
this.dataByte =
|
||||
getOrdinal(Skeleton.SkeletonType.values(), ((Skeleton) entity).getSkeletonType());
|
||||
this.dataByte = getOrdinal(Skeleton.SkeletonType.values(),
|
||||
((Skeleton) entity).getSkeletonType());
|
||||
storeLiving((LivingEntity) entity);
|
||||
return;
|
||||
case ARMOR_STAND:
|
||||
@ -323,7 +324,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
|
||||
void restoreEquipment(LivingEntity entity) {
|
||||
EntityEquipment equipment = entity.getEquipment();
|
||||
if (PlotSquared.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||
if (PlotSquared.get()
|
||||
.checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||
equipment.setItemInMainHand(this.lived.mainHand);
|
||||
equipment.setItemInOffHand(this.lived.offHand);
|
||||
} else {
|
||||
@ -367,7 +369,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
}
|
||||
|
||||
void storeEquipment(EntityEquipment equipment) {
|
||||
if (PlotSquared.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||
if (PlotSquared.get()
|
||||
.checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||
this.lived.mainHand = equipment.getItemInMainHand().clone();
|
||||
this.lived.offHand = equipment.getItemInOffHand().clone();
|
||||
} else {
|
||||
@ -412,8 +415,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
this.tamed.tamed = tamed.isTamed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity spawn(World world, int xOffset, int zOffset) {
|
||||
@Override public Entity spawn(World world, int xOffset, int zOffset) {
|
||||
Location location = new Location(world, this.x + xOffset, this.y, this.z + zOffset);
|
||||
location.setYaw(this.yaw);
|
||||
location.setPitch(this.pitch);
|
||||
@ -459,7 +461,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
if (this.depth == 1) {
|
||||
return entity;
|
||||
}
|
||||
if (PlotSquared.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_10_0)
|
||||
if (PlotSquared.get()
|
||||
.checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_10_0)
|
||||
|| entity instanceof ArmorStand) {
|
||||
if (this.noGravity) {
|
||||
entity.setGravity(false);
|
||||
@ -468,8 +471,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
switch (entity.getType()) {
|
||||
case ARROW:
|
||||
case BOAT:
|
||||
if (PlotSquared
|
||||
.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||
if (PlotSquared.get()
|
||||
.checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||
Boat boat = (Boat) entity;
|
||||
boat.setWoodType(TreeSpecies.values()[dataByte]);
|
||||
}
|
||||
@ -592,7 +595,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
return entity;
|
||||
case SKELETON:
|
||||
if (this.dataByte != 0) {
|
||||
((Skeleton) entity).setSkeletonType(Skeleton.SkeletonType.values()[this.dataByte]);
|
||||
((Skeleton) entity)
|
||||
.setSkeletonType(Skeleton.SkeletonType.values()[this.dataByte]);
|
||||
}
|
||||
storeLiving((LivingEntity) entity);
|
||||
return entity;
|
||||
@ -703,7 +707,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
public void saveEntity() {}
|
||||
public void saveEntity() {
|
||||
}
|
||||
|
||||
private byte getOrdinal(Object[] list, Object value) {
|
||||
for (byte i = 0; i < list.length; i++) {
|
||||
|
@ -52,10 +52,11 @@ public class TeleportEntityWrapper extends EntityWrapper {
|
||||
this.getEntity().setInvulnerable(true);
|
||||
this.fireTicksOld = this.getEntity().getFireTicks();
|
||||
this.livingTicksOld = this.getEntity().getTicksLived();
|
||||
this.getEntity().setMetadata("ps-tmp-teleport", new FixedMetadataValue(
|
||||
BukkitMain.getPlugin(BukkitMain.class), oldLocation));
|
||||
this.getEntity().setMetadata("ps-tmp-teleport",
|
||||
new FixedMetadataValue(BukkitMain.getPlugin(BukkitMain.class), oldLocation));
|
||||
final Chunk newChunk = getNewChunk();
|
||||
this.getEntity().teleport(new Location(newChunk.getWorld(), newChunk.getX() << 4, 5000, newChunk.getZ() << 4));
|
||||
this.getEntity().teleport(
|
||||
new Location(newChunk.getWorld(), newChunk.getX() << 4, 5000, newChunk.getZ() << 4));
|
||||
}
|
||||
|
||||
private Chunk getNewChunk() {
|
||||
|
@ -12,8 +12,8 @@ import org.bukkit.entity.Player;
|
||||
private final boolean valid;
|
||||
|
||||
public DefaultTitle_111() {
|
||||
this.valid = PlotSquared
|
||||
.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_11_0);
|
||||
this.valid = PlotSquared.get()
|
||||
.checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_11_0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -101,13 +101,16 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
return chunks;
|
||||
}
|
||||
|
||||
@Override public boolean copyRegion(
|
||||
com.github.intellectualsites.plotsquared.plot.object.Location pos1, com.github.intellectualsites.plotsquared.plot.object.Location pos2, com.github.intellectualsites.plotsquared.plot.object.Location newPos,
|
||||
@Override
|
||||
public boolean copyRegion(com.github.intellectualsites.plotsquared.plot.object.Location pos1,
|
||||
com.github.intellectualsites.plotsquared.plot.object.Location pos2,
|
||||
com.github.intellectualsites.plotsquared.plot.object.Location newPos,
|
||||
final Runnable whenDone) {
|
||||
final int relX = newPos.getX() - pos1.getX();
|
||||
final int relZ = newPos.getZ() - pos1.getZ();
|
||||
com.github.intellectualsites.plotsquared.plot.object.Location pos4 =
|
||||
new com.github.intellectualsites.plotsquared.plot.object.Location(newPos.getWorld(), newPos.getX() + relX, 256, newPos.getZ() + relZ);
|
||||
new com.github.intellectualsites.plotsquared.plot.object.Location(newPos.getWorld(),
|
||||
newPos.getX() + relX, 256, newPos.getZ() + relZ);
|
||||
|
||||
final RegionWrapper region =
|
||||
new RegionWrapper(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ());
|
||||
@ -159,7 +162,9 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public boolean regenerateRegion(final com.github.intellectualsites.plotsquared.plot.object.Location pos1, final com.github.intellectualsites.plotsquared.plot.object.Location pos2,
|
||||
@Override public boolean regenerateRegion(
|
||||
final com.github.intellectualsites.plotsquared.plot.object.Location pos1,
|
||||
final com.github.intellectualsites.plotsquared.plot.object.Location pos2,
|
||||
final boolean ignoreAugment, final Runnable whenDone) {
|
||||
final String world = pos1.getWorld();
|
||||
|
||||
@ -315,8 +320,9 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public void clearAllEntities(
|
||||
com.github.intellectualsites.plotsquared.plot.object.Location pos1, com.github.intellectualsites.plotsquared.plot.object.Location pos2) {
|
||||
@Override
|
||||
public void clearAllEntities(com.github.intellectualsites.plotsquared.plot.object.Location pos1,
|
||||
com.github.intellectualsites.plotsquared.plot.object.Location pos2) {
|
||||
String world = pos1.getWorld();
|
||||
List<Entity> entities = BukkitUtil.getEntities(world);
|
||||
int bx = pos1.getX();
|
||||
@ -355,7 +361,10 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void swap(com.github.intellectualsites.plotsquared.plot.object.Location bot1, com.github.intellectualsites.plotsquared.plot.object.Location top1, com.github.intellectualsites.plotsquared.plot.object.Location bot2, com.github.intellectualsites.plotsquared.plot.object.Location top2,
|
||||
@Override public void swap(com.github.intellectualsites.plotsquared.plot.object.Location bot1,
|
||||
com.github.intellectualsites.plotsquared.plot.object.Location top1,
|
||||
com.github.intellectualsites.plotsquared.plot.object.Location bot2,
|
||||
com.github.intellectualsites.plotsquared.plot.object.Location top2,
|
||||
final Runnable whenDone) {
|
||||
RegionWrapper region1 =
|
||||
new RegionWrapper(bot1.getX(), top1.getX(), bot1.getZ(), top1.getZ());
|
||||
@ -655,7 +664,8 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
|
||||
public void saveEntitiesOut(Chunk chunk, RegionWrapper region) {
|
||||
for (Entity entity : chunk.getEntities()) {
|
||||
com.github.intellectualsites.plotsquared.plot.object.Location loc = BukkitUtil.getLocation(entity);
|
||||
com.github.intellectualsites.plotsquared.plot.object.Location loc =
|
||||
BukkitUtil.getLocation(entity);
|
||||
int x = loc.getX();
|
||||
int z = loc.getZ();
|
||||
if (isIn(region, x, z)) {
|
||||
@ -673,7 +683,8 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
public void saveEntitiesIn(Chunk chunk, RegionWrapper region, int offsetX, int offsetZ,
|
||||
boolean delete) {
|
||||
for (Entity entity : chunk.getEntities()) {
|
||||
com.github.intellectualsites.plotsquared.plot.object.Location loc = BukkitUtil.getLocation(entity);
|
||||
com.github.intellectualsites.plotsquared.plot.object.Location loc =
|
||||
BukkitUtil.getLocation(entity);
|
||||
int x = loc.getX();
|
||||
int z = loc.getZ();
|
||||
if (!isIn(region, x, z)) {
|
||||
@ -894,14 +905,16 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
((NoteBlock) state).setNote(blockLocNoteEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate note block: " + (
|
||||
blockLocNoteEntry.getKey().x + xOffset) + ',' + blockLocNoteEntry
|
||||
.getKey().y + ',' + (blockLocNoteEntry.getKey().z + zOffset));
|
||||
PlotSquared.debug(
|
||||
"&c[WARN] Plot clear failed to regenerate note block: " + (
|
||||
blockLocNoteEntry.getKey().x + xOffset) + ',' + blockLocNoteEntry
|
||||
.getKey().y + ',' + (blockLocNoteEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate note block (e): " + (
|
||||
blockLocNoteEntry.getKey().x + xOffset) + ',' + blockLocNoteEntry.getKey().y
|
||||
+ ',' + (blockLocNoteEntry.getKey().z + zOffset));
|
||||
PlotSquared.debug(
|
||||
"&c[WARN] Plot clear failed to regenerate note block (e): " + (
|
||||
blockLocNoteEntry.getKey().x + xOffset) + ',' + blockLocNoteEntry
|
||||
.getKey().y + ',' + (blockLocNoteEntry.getKey().z + zOffset));
|
||||
}
|
||||
}
|
||||
for (Entry<BlockLoc, Short> blockLocShortEntry : this.brewTime.entrySet()) {
|
||||
@ -912,16 +925,16 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
if (state instanceof BrewingStand) {
|
||||
((BrewingStand) state).setBrewingTime(blockLocShortEntry.getValue());
|
||||
} else {
|
||||
PlotSquared
|
||||
.debug("&c[WARN] Plot clear failed to restore brewing stand cooking: " + (
|
||||
blockLocShortEntry.getKey().x + xOffset) + ',' + blockLocShortEntry
|
||||
.getKey().y + ',' + (blockLocShortEntry.getKey().z + zOffset));
|
||||
PlotSquared.debug(
|
||||
"&c[WARN] Plot clear failed to restore brewing stand cooking: " + (
|
||||
blockLocShortEntry.getKey().x + xOffset) + ',' + blockLocShortEntry
|
||||
.getKey().y + ',' + (blockLocShortEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
PlotSquared
|
||||
.debug("&c[WARN] Plot clear failed to restore brewing stand cooking (e): " + (
|
||||
blockLocShortEntry.getKey().x + xOffset) + ',' + blockLocShortEntry
|
||||
.getKey().y + ',' + (blockLocShortEntry.getKey().z + zOffset));
|
||||
PlotSquared.debug(
|
||||
"&c[WARN] Plot clear failed to restore brewing stand cooking (e): " + (
|
||||
blockLocShortEntry.getKey().x + xOffset) + ',' + blockLocShortEntry
|
||||
.getKey().y + ',' + (blockLocShortEntry.getKey().z + zOffset));
|
||||
}
|
||||
}
|
||||
for (Entry<BlockLoc, EntityType> blockLocEntityTypeEntry : this.spawnerData
|
||||
@ -957,14 +970,17 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
((CommandBlock) state).setCommand(blockLocStringEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to restore command block: " + (
|
||||
blockLocStringEntry.getKey().x + xOffset) + ',' + blockLocStringEntry
|
||||
.getKey().y + ',' + (blockLocStringEntry.getKey().z + zOffset));
|
||||
PlotSquared.debug(
|
||||
"&c[WARN] Plot clear failed to restore command block: " + (
|
||||
blockLocStringEntry.getKey().x + xOffset) + ','
|
||||
+ blockLocStringEntry.getKey().y + ',' + (
|
||||
blockLocStringEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to restore command block (e): " + (
|
||||
blockLocStringEntry.getKey().x + xOffset) + ',' + blockLocStringEntry
|
||||
.getKey().y + ',' + (blockLocStringEntry.getKey().z + zOffset));
|
||||
PlotSquared.debug(
|
||||
"&c[WARN] Plot clear failed to restore command block (e): " + (
|
||||
blockLocStringEntry.getKey().x + xOffset) + ',' + blockLocStringEntry
|
||||
.getKey().y + ',' + (blockLocStringEntry.getKey().z + zOffset));
|
||||
}
|
||||
}
|
||||
for (Entry<BlockLoc, ItemStack[]> blockLocEntry : this.brewingStandContents
|
||||
@ -979,16 +995,16 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
.setContents(blockLocEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PlotSquared
|
||||
.debug("&c[WARN] Plot clear failed to regenerate brewing stand: " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
PlotSquared.debug(
|
||||
"&c[WARN] Plot clear failed to regenerate brewing stand: " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
PlotSquared
|
||||
.debug("&c[WARN] Plot clear failed to regenerate brewing stand (e): " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||
+ (blockLocEntry.getKey().z + zOffset));
|
||||
PlotSquared.debug(
|
||||
"&c[WARN] Plot clear failed to regenerate brewing stand (e): " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
}
|
||||
for (Entry<BlockLoc, Short[]> blockLocEntry : this.furnaceTime.entrySet()) {
|
||||
@ -1002,16 +1018,16 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
((Furnace) state).setBurnTime(time[0]);
|
||||
((Furnace) state).setCookTime(time[1]);
|
||||
} else {
|
||||
PlotSquared
|
||||
.debug("&c[WARN] Plot clear failed to restore furnace cooking: " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
PlotSquared.debug(
|
||||
"&c[WARN] Plot clear failed to restore furnace cooking: " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
PlotSquared
|
||||
.debug("&c[WARN] Plot clear failed to restore furnace cooking (e): " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||
+ (blockLocEntry.getKey().z + zOffset));
|
||||
PlotSquared.debug(
|
||||
"&c[WARN] Plot clear failed to restore furnace cooking (e): " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
}
|
||||
for (Entry<BlockLoc, ItemStack[]> blockLocEntry : this.furnaceContents.entrySet()) {
|
||||
|
@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -83,14 +84,23 @@ public class BukkitEventUtil extends EventUtil {
|
||||
callEvent(new PlayerPlotHelperEvent(getPlayer(initiator), plot, player, added));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean callOwnerChange(PlotPlayer initiator, Plot plot, UUID oldOwner, UUID newOwner,
|
||||
boolean hasOldOwner) {
|
||||
return callEvent(
|
||||
new PlotChangeOwnerEvent(getPlayer(initiator), plot, oldOwner, newOwner, hasOldOwner));
|
||||
}
|
||||
|
||||
@Override public boolean callFlagRemove(Flag flag, Object object, PlotCluster cluster) {
|
||||
return callEvent(new ClusterFlagRemoveEvent(flag, cluster));
|
||||
}
|
||||
|
||||
@Override public Rating callRating(PlotPlayer player, Plot plot, Rating rating) {
|
||||
@Override @Nullable public Rating callRating(PlotPlayer player, Plot plot, Rating rating) {
|
||||
PlotRateEvent event = new PlotRateEvent(player, rating, plot);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return null;
|
||||
}
|
||||
return event.getRating();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -132,8 +132,10 @@ public class BukkitSetupUtils extends SetupUtils {
|
||||
worldSection.set(step.getConstant(), step.getValue());
|
||||
}
|
||||
PlotSquared.get().worlds.set("worlds." + world + ".generator.type", object.type);
|
||||
PlotSquared.get().worlds.set("worlds." + world + ".generator.terrain", object.terrain);
|
||||
PlotSquared.get().worlds.set("worlds." + world + ".generator.plugin", object.plotManager);
|
||||
PlotSquared.get().worlds
|
||||
.set("worlds." + world + ".generator.terrain", object.terrain);
|
||||
PlotSquared.get().worlds
|
||||
.set("worlds." + world + ".generator.plugin", object.plotManager);
|
||||
if (object.setupGenerator != null && !object.setupGenerator
|
||||
.equals(object.plotManager)) {
|
||||
PlotSquared.get().worlds
|
||||
|
@ -24,8 +24,7 @@ import org.bukkit.material.*;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings({"unused", "WeakerAccess"})
|
||||
public class BukkitUtil extends WorldUtil {
|
||||
@SuppressWarnings({"unused", "WeakerAccess"}) public class BukkitUtil extends WorldUtil {
|
||||
|
||||
private static String lastString = null;
|
||||
private static World lastWorld = null;
|
||||
@ -86,7 +85,7 @@ public class BukkitUtil extends WorldUtil {
|
||||
|
||||
/**
|
||||
* Get the PlotPlayer for an offline player.
|
||||
* <p>
|
||||
*
|
||||
* <p>Note that this will work if the player is offline, however not all
|
||||
* functionality will work.
|
||||
*
|
||||
@ -242,8 +241,9 @@ public class BukkitUtil extends WorldUtil {
|
||||
return getWorld(world).getBiome(x, z).name();
|
||||
}
|
||||
|
||||
@Override @SuppressWarnings("deprecation") public void setSign(@NonNull final String worldName,
|
||||
final int x, final int y, final int z, @NonNull final String[] lines) {
|
||||
@Override @SuppressWarnings("deprecation")
|
||||
public void setSign(@NonNull final String worldName, final int x, final int y, final int z,
|
||||
@NonNull final String[] lines) {
|
||||
final World world = getWorld(worldName);
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
// block.setType(Material.AIR);
|
||||
@ -351,7 +351,8 @@ public class BukkitUtil extends WorldUtil {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override public boolean addItems(@NonNull final String worldName, @NonNull final PlotItem items) {
|
||||
@Override
|
||||
public boolean addItems(@NonNull final String worldName, @NonNull final PlotItem items) {
|
||||
final World world = getWorld(worldName);
|
||||
final Block block = world.getBlockAt(items.x, items.y, items.z);
|
||||
if (block == null) {
|
||||
@ -403,7 +404,8 @@ public class BukkitUtil extends WorldUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@Override @Nullable public StringComparison<PlotBlock>.ComparisonResult getClosestBlock(String name) {
|
||||
@Override @Nullable
|
||||
public StringComparison<PlotBlock>.ComparisonResult getClosestBlock(String name) {
|
||||
try {
|
||||
final Material material = Material.valueOf(name.toUpperCase());
|
||||
return new StringComparison<PlotBlock>().new ComparisonResult(0,
|
||||
@ -439,7 +441,8 @@ public class BukkitUtil extends WorldUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public void setBiomes(@NonNull final String worldName, @NonNull final RegionWrapper region,
|
||||
@Override
|
||||
public void setBiomes(@NonNull final String worldName, @NonNull final RegionWrapper region,
|
||||
@NonNull final String biomeString) {
|
||||
final World world = getWorld(worldName);
|
||||
final Biome biome = Biome.valueOf(biomeString.toUpperCase());
|
||||
|
@ -50,7 +50,8 @@ public class SendChunk {
|
||||
RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||
this.methodInitLighting = classChunk.getMethod("initLighting");
|
||||
RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk");
|
||||
if (PlotSquared.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_4)) {
|
||||
if (PlotSquared.get()
|
||||
.checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_4)) {
|
||||
//this works for 1.9.4 and 1.10
|
||||
tempMapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), int.class);
|
||||
} else {
|
||||
@ -118,8 +119,8 @@ public class SendChunk {
|
||||
chunks.remove(chunk);
|
||||
Object con = this.connection.of(entity).get();
|
||||
Object packet = null;
|
||||
if (PlotSquared
|
||||
.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_4)) {
|
||||
if (PlotSquared.get()
|
||||
.checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_4)) {
|
||||
try {
|
||||
packet = this.mapChunk.create(c, 65535);
|
||||
} catch (Exception ignored) {
|
||||
@ -148,10 +149,11 @@ public class SendChunk {
|
||||
chunk.unload(true, false);
|
||||
} catch (Throwable ignored) {
|
||||
String worldName = chunk.getWorld().getName();
|
||||
PlotSquared.debug(
|
||||
"$4Could not save chunk: " + worldName + ';' + chunk.getX() + ";"
|
||||
+ chunk.getZ());
|
||||
PlotSquared
|
||||
.debug("$4Could not save chunk: " + worldName + ';' + chunk.getX() + ";"
|
||||
+ chunk.getZ());
|
||||
PlotSquared.debug("$3 - $4File may be open in another process (e.g. MCEdit)");
|
||||
.debug("$3 - $4File may be open in another process (e.g. MCEdit)");
|
||||
PlotSquared.debug("$3 - $4" + worldName + "/level.dat or " + worldName
|
||||
+ "/level_old.dat may be corrupt (try repairing or removing these)");
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ public class SetGenCB {
|
||||
}
|
||||
}
|
||||
}
|
||||
PlotSquared.get().loadWorld(world.getName(), PlotSquared.get().IMP.getGenerator(world.getName(), null));
|
||||
PlotSquared.get()
|
||||
.loadWorld(world.getName(), PlotSquared.get().IMP.getGenerator(world.getName(), null));
|
||||
}
|
||||
}
|
||||
|
@ -203,7 +203,8 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
PlotSquared.debug(C.PREFIX + "&6Invalid PlayerData: " + uuid.toString() + ".dat");
|
||||
PlotSquared
|
||||
.debug(C.PREFIX + "&6Invalid PlayerData: " + uuid.toString() + ".dat");
|
||||
}
|
||||
}
|
||||
for (String name : names) {
|
||||
|
@ -43,7 +43,8 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
|
||||
public SQLUUIDHandler(UUIDWrapper wrapper) {
|
||||
super(wrapper);
|
||||
this.sqlite = new SQLite(MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), "usercache.db"));
|
||||
this.sqlite =
|
||||
new SQLite(MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), "usercache.db"));
|
||||
try {
|
||||
this.sqlite.openConnection();
|
||||
} catch (ClassNotFoundException | SQLException e) {
|
||||
@ -221,7 +222,8 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
statement.setString(1, uuid.toString());
|
||||
statement.setString(2, name.toString());
|
||||
statement.execute();
|
||||
PlotSquared.debug(C.PREFIX + "&cAdded '&6" + uuid + "&c' - '&6" + name + "&c'");
|
||||
PlotSquared
|
||||
.debug(C.PREFIX + "&cAdded '&6" + uuid + "&c' - '&6" + name + "&c'");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -244,8 +246,8 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
statement.setString(1, name.value);
|
||||
statement.setString(2, uuid.toString());
|
||||
statement.execute();
|
||||
PlotSquared
|
||||
.debug(C.PREFIX + "Name change for '" + uuid + "' to '" + name.value + '\'');
|
||||
PlotSquared.debug(
|
||||
C.PREFIX + "Name change for '" + uuid + "' to '" + name.value + '\'');
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
Reference in New Issue
Block a user