mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 14:46:45 +01:00
Minor fixes
JavaDoc Fixes Useful additions
This commit is contained in:
parent
8261b944b2
commit
a4f55dc3f6
@ -153,7 +153,7 @@ public class Auto extends SubCommand {
|
||||
Plot plot = PlotHelper.getPlot(world, Auto.lastPlot);
|
||||
if ((plot == null) || (plot.owner == null)) {
|
||||
plot = PlotHelper.getPlot(world, Auto.lastPlot);
|
||||
Claim.claimPlot(plr, plot, true);
|
||||
Claim.claimPlot(plr, plot, true, true);
|
||||
br = true;
|
||||
final PlotWorld pw = PlotMain.getWorldSettings(world);
|
||||
final Plot plot2 = PlotMain.getPlots(world).get(plot.id);
|
||||
@ -187,7 +187,7 @@ public class Auto extends SubCommand {
|
||||
for (int j = start.y; j <= end.y; j++) {
|
||||
final Plot plot = PlotHelper.getPlot(world, new PlotId(i, j));
|
||||
final boolean teleport = ((i == end.x) && (j == end.y));
|
||||
Claim.claimPlot(plr, plot, teleport);
|
||||
Claim.claimPlot(plr, plot, teleport, true);
|
||||
}
|
||||
}
|
||||
if (!PlotHelper.mergePlots(plr, world, PlayerFunctions.getPlotSelectionIds(world, start, end))) {
|
||||
|
@ -47,12 +47,12 @@ public class Claim extends SubCommand {
|
||||
super(Command.CLAIM, "Claim the current plot you're standing on.", "claim", CommandCategory.CLAIMING, true);
|
||||
}
|
||||
|
||||
public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport) {
|
||||
return claimPlot(player, plot, teleport, "");
|
||||
public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport, boolean auto) {
|
||||
return claimPlot(player, plot, teleport, "", auto);
|
||||
}
|
||||
|
||||
public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport, final String schematic) {
|
||||
final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot);
|
||||
public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport, final String schematic, boolean auto) {
|
||||
final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot, auto);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
PlotHelper.createPlot(player, plot);
|
||||
@ -134,6 +134,6 @@ public class Claim extends SubCommand {
|
||||
}
|
||||
}
|
||||
|
||||
return !claimPlot(plr, plot, false, schematic) || sendMessage(plr, C.PLOT_NOT_CLAIMED);
|
||||
return !claimPlot(plr, plot, false, schematic, false) || sendMessage(plr, C.PLOT_NOT_CLAIMED);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class DebugClaimTest extends SubCommand {
|
||||
}
|
||||
|
||||
public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport, @SuppressWarnings("unused") final String schematic) {
|
||||
final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot);
|
||||
final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot, true);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
PlotHelper.createPlot(player, plot);
|
||||
|
@ -28,22 +28,26 @@ import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
/**
|
||||
* Created by Citymonstret on 2014-08-09.
|
||||
* @author Citymonstret
|
||||
* @author Empire92
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class PlayerClaimPlotEvent extends PlayerEvent implements Cancellable {
|
||||
private static HandlerList handlers = new HandlerList();
|
||||
private final Plot plot;
|
||||
private final boolean auto;
|
||||
private boolean cancelled;
|
||||
|
||||
/**
|
||||
* PlayerClaimPlotEvent: Called when a plot is claimed
|
||||
*
|
||||
* @param player
|
||||
* @param plot
|
||||
* @param player Player that claimed the plot
|
||||
* @param plot Plot that was claimed
|
||||
*/
|
||||
public PlayerClaimPlotEvent(final Player player, final Plot plot) {
|
||||
public PlayerClaimPlotEvent(final Player player, final Plot plot, boolean auto) {
|
||||
super(player);
|
||||
this.plot = plot;
|
||||
this.auto = auto;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
@ -59,6 +63,13 @@ public class PlayerClaimPlotEvent extends PlayerEvent implements Cancellable {
|
||||
return this.plot;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if it was an automated claim, else false
|
||||
*/
|
||||
public boolean wasAuto() {
|
||||
return this.auto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
|
@ -27,7 +27,8 @@ import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
/**
|
||||
* Created by Citymonstret on 2014-08-16.
|
||||
* @author Citymonstret
|
||||
* @author Empire92
|
||||
*/
|
||||
public class PlayerEnterPlotEvent extends PlayerEvent {
|
||||
|
||||
@ -38,8 +39,8 @@ public class PlayerEnterPlotEvent extends PlayerEvent {
|
||||
/**
|
||||
* PlayerEnterPlotEvent: Called when a player leaves a plot
|
||||
*
|
||||
* @param player
|
||||
* @param plot
|
||||
* @param player Player that entered the plot
|
||||
* @param plot Plot that was entered
|
||||
*/
|
||||
public PlayerEnterPlotEvent(final Player player, final Plot plot) {
|
||||
super(player);
|
||||
|
@ -27,7 +27,8 @@ import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
/**
|
||||
* Created by Citymonstret on 2014-08-16.
|
||||
* @author Citymonstret
|
||||
* @author Empire92
|
||||
*/
|
||||
public class PlayerLeavePlotEvent extends PlayerEvent {
|
||||
private static HandlerList handlers = new HandlerList();
|
||||
@ -37,8 +38,8 @@ public class PlayerLeavePlotEvent extends PlayerEvent {
|
||||
/**
|
||||
* PlayerLeavePlotEvent: Called when a player leaves a plot
|
||||
*
|
||||
* @param player
|
||||
* @param plot
|
||||
* @param player Player that left the plot
|
||||
* @param plot Plot that was left
|
||||
*/
|
||||
public PlayerLeavePlotEvent(final Player player, final Plot plot) {
|
||||
super(player);
|
||||
|
@ -29,7 +29,8 @@ import org.bukkit.event.HandlerList;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created by Citymonstret on 2014-08-16.
|
||||
* @author Citymonstret
|
||||
* @author Empire92
|
||||
*/
|
||||
public class PlayerPlotDeniedEvent extends Event {
|
||||
private static HandlerList handlers = new HandlerList();
|
||||
@ -43,10 +44,10 @@ public class PlayerPlotDeniedEvent extends Event {
|
||||
* PlayerPlotDeniedEvent: Called when the denied UUID list is modified for a
|
||||
* plot
|
||||
*
|
||||
* @param initiator
|
||||
* @param plot
|
||||
* @param player
|
||||
* @param added
|
||||
* @param initiator Player that initiated the event
|
||||
* @param plot Plot in which the event occurred
|
||||
* @param player Player that was denied/un-denied
|
||||
* @param added true of add to deny list, false if removed
|
||||
*/
|
||||
public PlayerPlotDeniedEvent(final Player initiator, final Plot plot, final UUID player, final boolean added) {
|
||||
this.initiator = initiator;
|
||||
|
@ -29,7 +29,8 @@ import org.bukkit.event.HandlerList;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created by Citymonstret on 2014-08-16.
|
||||
* @author Empire92
|
||||
* @author Citymonstret
|
||||
*/
|
||||
public class PlayerPlotHelperEvent extends Event {
|
||||
private static HandlerList handlers = new HandlerList();
|
||||
@ -42,10 +43,10 @@ public class PlayerPlotHelperEvent extends Event {
|
||||
/**
|
||||
* PlayerPlotHelperEvent: Called when a plot helper is added/removed
|
||||
*
|
||||
* @param initiator
|
||||
* @param plot
|
||||
* @param player
|
||||
* @param added
|
||||
* @param initiator Player that initiated the event
|
||||
* @param plot Plot in which the event occurred
|
||||
* @param player Player that was added/removed from the helper list
|
||||
* @param added true of the player was added, false if the player was removed
|
||||
*/
|
||||
public PlayerPlotHelperEvent(final Player initiator, final Plot plot, final UUID player, final boolean added) {
|
||||
this.initiator = initiator;
|
||||
|
@ -29,7 +29,8 @@ import org.bukkit.event.HandlerList;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created by Citymonstret on 2014-08-16.
|
||||
* @author Citymonstret
|
||||
* @author Empire92
|
||||
*/
|
||||
public class PlayerPlotTrustedEvent extends Event {
|
||||
private static HandlerList handlers = new HandlerList();
|
||||
@ -42,10 +43,10 @@ public class PlayerPlotTrustedEvent extends Event {
|
||||
/**
|
||||
* PlayerPlotTrustedEvent: Called when a plot trusted user is added/removed
|
||||
*
|
||||
* @param initiator
|
||||
* @param plot
|
||||
* @param player
|
||||
* @param added
|
||||
* @param initiator Player that initiated the event
|
||||
* @param plot Plot in which the event occurred
|
||||
* @param player Player that was added/removed from the trusted list
|
||||
* @param added true of the player was added, false if the player was removed
|
||||
*/
|
||||
public PlayerPlotTrustedEvent(final Player initiator, final Plot plot, final UUID player, final boolean added) {
|
||||
this.initiator = initiator;
|
||||
|
@ -30,6 +30,9 @@ import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
/**
|
||||
* Called when a player teleports to a plot
|
||||
*
|
||||
* @author Citymonstret
|
||||
* @author Empire92
|
||||
*/
|
||||
public class PlayerTeleportToPlotEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@ -42,9 +45,9 @@ public class PlayerTeleportToPlotEvent extends PlayerEvent implements Cancellabl
|
||||
/**
|
||||
* PlayerTeleportToPlotEvent: Called when a player teleports to a plot
|
||||
*
|
||||
* @param player
|
||||
* @param from
|
||||
* @param plot
|
||||
* @param player That was teleported
|
||||
* @param from Start location
|
||||
* @param plot Plot to which the player was teleported
|
||||
*/
|
||||
public PlayerTeleportToPlotEvent(final Player player, final Location from, final Plot plot) {
|
||||
super(player);
|
||||
|
@ -28,6 +28,9 @@ import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a plot is cleared
|
||||
*
|
||||
* @author Citymonstret
|
||||
* @author Empire92
|
||||
*/
|
||||
public class PlotClearEvent extends Event implements Cancellable {
|
||||
private static HandlerList handlers = new HandlerList();
|
||||
@ -38,8 +41,8 @@ public class PlotClearEvent extends Event implements Cancellable {
|
||||
/**
|
||||
* PlotDeleteEvent: Called when a plot is cleared
|
||||
*
|
||||
* @param world
|
||||
* @param id
|
||||
* @param world The world in which the plot was cleared
|
||||
* @param id The plot that was cleared
|
||||
*/
|
||||
public PlotClearEvent(final String world, final PlotId id) {
|
||||
this.id = id;
|
||||
|
@ -28,6 +28,9 @@ import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a plot is deleted
|
||||
*
|
||||
* @author Citymonstret
|
||||
* @author Empire92
|
||||
*/
|
||||
public class PlotDeleteEvent extends Event implements Cancellable {
|
||||
private static HandlerList handlers = new HandlerList();
|
||||
@ -38,8 +41,8 @@ public class PlotDeleteEvent extends Event implements Cancellable {
|
||||
/**
|
||||
* PlotDeleteEvent: Called when a plot is deleted
|
||||
*
|
||||
* @param world
|
||||
* @param id
|
||||
* @param world The world in which the plot was deleted
|
||||
* @param id The ID of the plot that was deleted
|
||||
*/
|
||||
public PlotDeleteEvent(final String world, final PlotId id) {
|
||||
this.id = id;
|
||||
|
@ -29,6 +29,9 @@ import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a Flag is added to a plot
|
||||
*
|
||||
* @author Citymonstret
|
||||
* @author Empire92
|
||||
*/
|
||||
public class PlotFlagAddEvent extends Event implements Cancellable {
|
||||
private static HandlerList handlers = new HandlerList();
|
||||
@ -39,8 +42,8 @@ public class PlotFlagAddEvent extends Event implements Cancellable {
|
||||
/**
|
||||
* PlotFlagAddEvent: Called when a Flag is added to a plot
|
||||
*
|
||||
* @param flag
|
||||
* @param plot
|
||||
* @param flag Flag that was added
|
||||
* @param plot Plot to which the flag was added
|
||||
*/
|
||||
public PlotFlagAddEvent(final Flag flag, final Plot plot) {
|
||||
this.plot = plot;
|
||||
|
@ -29,6 +29,9 @@ import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a flag is removed from a plot
|
||||
*
|
||||
* @author Citymonstret
|
||||
* @author Empire92
|
||||
*/
|
||||
public class PlotFlagRemoveEvent extends Event implements Cancellable {
|
||||
private static HandlerList handlers = new HandlerList();
|
||||
@ -39,8 +42,8 @@ public class PlotFlagRemoveEvent extends Event implements Cancellable {
|
||||
/**
|
||||
* PlotFlagRemoveEvent: Called when a flag is removed from a plot
|
||||
*
|
||||
* @param flag
|
||||
* @param plot
|
||||
* @param flag Flag that was removed
|
||||
* @param plot Plot from which the flag was removed
|
||||
*/
|
||||
public PlotFlagRemoveEvent(final Flag flag, final Plot plot) {
|
||||
this.plot = plot;
|
||||
|
@ -31,7 +31,7 @@ import org.bukkit.event.HandlerList;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by Citymonstret on 2014-08-09.
|
||||
* @author Empire92
|
||||
*/
|
||||
public class PlotMergeEvent extends Event implements Cancellable {
|
||||
private static HandlerList handlers = new HandlerList();
|
||||
@ -43,8 +43,9 @@ public class PlotMergeEvent extends Event implements Cancellable {
|
||||
/**
|
||||
* PlotMergeEvent: Called when plots are merged
|
||||
*
|
||||
* @param player
|
||||
* @param plot
|
||||
* @param world World in which the event occurred
|
||||
* @param plot Plot that was merged
|
||||
* @param plots A list of plots involved in the event
|
||||
*/
|
||||
public PlotMergeEvent(final World world, final Plot plot, final ArrayList<PlotId> plots) {
|
||||
this.plots = plots;
|
||||
|
@ -30,7 +30,7 @@ import org.bukkit.event.HandlerList;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by Citymonstret on 2014-08-09.
|
||||
* @author Empire92
|
||||
*/
|
||||
public class PlotUnlinkEvent extends Event implements Cancellable {
|
||||
private static HandlerList handlers = new HandlerList();
|
||||
@ -41,8 +41,8 @@ public class PlotUnlinkEvent extends Event implements Cancellable {
|
||||
/**
|
||||
* Called when a mega-plot is unlinked.
|
||||
*
|
||||
* @param world
|
||||
* @param plots
|
||||
* @param world World in which the event occurred
|
||||
* @param plots Plots that are involved in the event
|
||||
*/
|
||||
public PlotUnlinkEvent(final World world, final ArrayList<PlotId> plots) {
|
||||
this.plots = plots;
|
||||
|
@ -52,11 +52,15 @@ public class AbstractFlag {
|
||||
throw new IllegalArgumentException("Key must be <= 16 characters");
|
||||
}
|
||||
this.key = key.toLowerCase();
|
||||
this.value = new FlagValue.StringValue();
|
||||
if (value == null) {
|
||||
this.value = new FlagValue.StringValue();
|
||||
} else {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public String parseValue(final String value) {
|
||||
return this.value.parse(value).toString();
|
||||
return this.value.parse(value);
|
||||
}
|
||||
|
||||
public String getValueDesc() {
|
||||
|
@ -33,6 +33,7 @@ import java.util.Random;
|
||||
/**
|
||||
* @author Citymonstret
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class XPopulator extends BlockPopulator {
|
||||
|
||||
/*
|
||||
@ -237,7 +238,6 @@ public class XPopulator extends BlockPopulator {
|
||||
setCuboidRegion(16 - value, (16 - value) + 1, this.roadheight, this.roadheight + 1, start, 16, this.floor2, w); //
|
||||
}
|
||||
if ((roadStartZ <= 16) && (roadStartZ > 1)) {
|
||||
final int val = roadStartZ;
|
||||
int start, end;
|
||||
if ((plotMinX + 2) <= 16) {
|
||||
start = 16 - plotMinX - 1;
|
||||
@ -252,11 +252,10 @@ public class XPopulator extends BlockPopulator {
|
||||
if (!(((plotMinX + 2) <= 16) || ((roadStartX - 1) <= 16))) {
|
||||
start = 0;
|
||||
}
|
||||
setCuboidRegion(0, end, this.roadheight, this.roadheight + 1, (16 - val) + 1, (16 - val) + 2, this.floor2, w);
|
||||
setCuboidRegion(start, 16, this.roadheight, this.roadheight + 1, (16 - val) + 1, (16 - val) + 2, this.floor2, w);
|
||||
setCuboidRegion(0, end, this.roadheight, this.roadheight + 1, (16 - roadStartZ) + 1, (16 - roadStartZ) + 2, this.floor2, w);
|
||||
setCuboidRegion(start, 16, this.roadheight, this.roadheight + 1, (16 - roadStartZ) + 1, (16 - roadStartZ) + 2, this.floor2, w);
|
||||
}
|
||||
if ((roadStartX <= 16) && (roadStartX > 1)) {
|
||||
final int val = roadStartX;
|
||||
int start, end;
|
||||
if ((plotMinZ + 2) <= 16) {
|
||||
start = 16 - plotMinZ - 1;
|
||||
@ -271,8 +270,8 @@ public class XPopulator extends BlockPopulator {
|
||||
if (!(((plotMinZ + 2) <= 16) || ((roadStartZ - 1) <= 16))) {
|
||||
start = 0;
|
||||
}
|
||||
setCuboidRegion((16 - val) + 1, (16 - val) + 2, this.roadheight, this.roadheight + 1, 0, end, this.floor2, w); //
|
||||
setCuboidRegion((16 - val) + 1, (16 - val) + 2, this.roadheight, this.roadheight + 1, start, 16, this.floor2, w); //
|
||||
setCuboidRegion((16 - roadStartX) + 1, (16 - roadStartX) + 2, this.roadheight, this.roadheight + 1, 0, end, this.floor2, w); //
|
||||
setCuboidRegion((16 - roadStartX) + 1, (16 - roadStartX) + 2, this.roadheight, this.roadheight + 1, start, 16, this.floor2, w); //
|
||||
}
|
||||
}
|
||||
// WALLS
|
||||
@ -460,6 +459,7 @@ public class XPopulator extends BlockPopulator {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void setBlock(final World w, final int x, final int y, final int z, final short id, final byte val) {
|
||||
w.getBlockAt(this.X + x, y, this.Z + z).setData(val, false);
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import org.bukkit.inventory.Inventory;
|
||||
*
|
||||
* @author Citymonstret
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class InventoryListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
|
@ -21,6 +21,10 @@
|
||||
|
||||
package com.intellectualcrafters.plot.object;
|
||||
|
||||
import com.sun.istack.internal.NotNull;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
/**
|
||||
* Wrapper class for blocks, using
|
||||
* pure data rather than the object.
|
||||
@ -28,16 +32,34 @@ package com.intellectualcrafters.plot.object;
|
||||
* Useful for NMS
|
||||
*
|
||||
* @author Empire92
|
||||
* @author Citymonstret
|
||||
*/
|
||||
public class BlockWrapper {
|
||||
|
||||
// Public Final //////////////////////////
|
||||
public final int x; //
|
||||
public final int y; //
|
||||
public final int z; //
|
||||
public final int id; //
|
||||
public final byte data; //
|
||||
//////////////////////////////////////////
|
||||
/**
|
||||
* X Coordinate
|
||||
*/
|
||||
public final int x;
|
||||
|
||||
/**
|
||||
* Y Coordinate
|
||||
*/
|
||||
public final int y;
|
||||
|
||||
/**
|
||||
* Z Coordinate
|
||||
*/
|
||||
public final int z;
|
||||
|
||||
/**
|
||||
* Block ID
|
||||
*/
|
||||
public final int id;
|
||||
|
||||
/**
|
||||
* Block Data Value
|
||||
*/
|
||||
public final byte data;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -48,11 +70,39 @@ public class BlockWrapper {
|
||||
* @param id Material ID
|
||||
* @param data Data Value
|
||||
*/
|
||||
public BlockWrapper(int x, int y, int z, short id, byte data) {
|
||||
public BlockWrapper(final int x, final int y, final int z, final short id, final byte data) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.id = id;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alternative Constructor
|
||||
* Uses block data, rather than typed data
|
||||
*
|
||||
* @param block Block from which we get the data
|
||||
*/
|
||||
@SuppressWarnings({"deprecation", "unused"})
|
||||
public BlockWrapper(@NotNull final Block block) {
|
||||
this.x = block.getX();
|
||||
this.y = block.getY();
|
||||
this.z = block.getZ();
|
||||
this.id = block.getTypeId();
|
||||
this.data = block.getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a block based on the block wrapper
|
||||
*
|
||||
* @param world World in which the block is/will be, located
|
||||
* @return block created/fetched from settings
|
||||
*/
|
||||
@SuppressWarnings({"unused", "deprecation"})
|
||||
public Block toBlock(@NotNull final World world) {
|
||||
Block block = world.getBlockAt(x, y, z);
|
||||
block.setTypeIdAndData(id, data, true);
|
||||
return block;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user