This commit is contained in:
boy0001 2015-02-20 17:09:53 +11:00
parent 3f71e0e772
commit 80af190718
5 changed files with 30 additions and 97 deletions

View File

@ -0,0 +1,18 @@
package com.intellectualcrafters.plot.config;
public class Permissions {
// ADMIN
public static String ADMIN = "plots.admin";
// BUILD
public static String BUILD_OTHER = "plots.admin.build.other";
public static String BUILD_ROAD = "plots.admin.build.road";
public static String BUILD_UNOWNED = "plots.admin.build.unowned";
// INTERACT
public static String INTERACT_OTHER = "plots.admin.interact.other";
public static String INTERACT_ROAD = "plots.admin.interact.road";
public static String INTERACT_UNOWNED = "plots.admin.interact.unowned";
// BREAK
public static String BREAK_OTHER = "plots.admin.break.other";
public static String BREAK_ROAD = "plots.admin.break.road";
public static String BREAK_UNOWNED = "plots.admin.break.unowned";
}

View File

@ -26,11 +26,6 @@ import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.BukkitMain;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.Flag;
@ -87,33 +82,6 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
public boolean hasChanged = false;
public boolean countsTowardsMax = true;
/**
* Primary constructor
*
* @param id
* @param owner
* @param plotBiome
* @param helpers
* @param denied
*
* @deprecated
*/
@Deprecated
@SuppressWarnings("unused")
public Plot(final PlotId id, final UUID owner, final Biome plotBiome, final ArrayList<UUID> helpers, final ArrayList<UUID> denied, final String world) {
this.id = id;
this.settings = new PlotSettings(this);
this.owner = owner;
this.deny_entry = this.owner == null;
this.helpers = helpers;
this.denied = denied;
this.trusted = new ArrayList<>();
this.settings.setAlias("");
this.delete = false;
this.settings.flags = new HashSet<Flag>();
this.world = world;
}
/**
* Primary constructor
*
@ -136,40 +104,6 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
this.world = world;
}
/**
* Constructor for saved plots
*
* @param id
* @param owner
* @param plotBiome
* @param helpers
* @param denied
* @param merged
*
* @deprecated
*/
@Deprecated
@SuppressWarnings("unused")
public Plot(final PlotId id, final UUID owner, final Biome plotBiome, final ArrayList<UUID> helpers, final ArrayList<UUID> trusted, final ArrayList<UUID> denied, final String alias, final BlockLoc position, final Set<Flag> flags, final String world, final boolean[] merged) {
this.id = id;
this.settings = new PlotSettings(this);
this.owner = owner;
this.deny_entry = this.owner != null;
this.trusted = trusted;
this.helpers = helpers;
this.denied = denied;
this.settings.setAlias(alias);
this.settings.setPosition(position);
this.settings.setMerged(merged);
this.delete = false;
if (flags != null) {
this.settings.flags = flags;
} else {
this.settings.flags = new HashSet<Flag>();
}
this.world = world;
}
/**
* Constructor for saved plots
*
@ -215,8 +149,8 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
*
* @return true if the player is added as a helper or is the owner
*/
public boolean hasRights(final Player player) {
return BukkitMain.hasPermission(player, "plots.admin.build.other") || ((this.helpers != null) && this.helpers.contains(DBFunc.everyone)) || ((this.helpers != null) && this.helpers.contains(UUIDHandler.getUUID(player))) || ((this.owner != null) && this.owner.equals(UUIDHandler.getUUID(player))) || ((this.owner != null) && (this.trusted != null) && (UUIDHandler.uuidWrapper.getPlayer(this.owner) != null) && (this.trusted.contains(UUIDHandler.getUUID(player)) || this.trusted.contains(DBFunc.everyone)));
public boolean isAdded(final UUID uuid) {
return ((this.helpers != null) && this.helpers.contains(DBFunc.everyone)) || ((this.helpers != null) && this.helpers.contains(uuid)) || ((this.owner != null) && this.owner.equals(uuid)) || ((this.owner != null) && (this.trusted != null) && (UUIDHandler.uuidWrapper.getPlayer(this.owner) != null) && (this.trusted.contains(uuid) || this.trusted.contains(DBFunc.everyone)));
}
/**
@ -226,8 +160,8 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
*
* @return false if the player is allowed to enter
*/
public boolean deny_entry(final Player player) {
return (this.denied != null) && ((this.denied.contains(DBFunc.everyone) && !this.hasRights(player)) || (!this.hasRights(player) && this.denied.contains(UUIDHandler.getUUID(player))));
public boolean isDenied(final UUID uuid) {
return (this.denied != null) && ((this.denied.contains(DBFunc.everyone) && !this.isAdded(uuid)) || (!this.isAdded(uuid) && this.denied.contains(uuid)));
}
/**
@ -242,8 +176,8 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
*
* @param player
*/
public void setOwner(final Player player) {
this.owner = UUIDHandler.getUUID(player);
public void setOwner(final UUID uuid) {
this.owner = uuid;
}
/**
@ -253,13 +187,6 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
return this.id;
}
/**
* Get the plot World
*/
public World getWorld() {
return Bukkit.getWorld(this.world);
}
/**
* Get a clone of the plot
*
@ -269,7 +196,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
public Object clone() throws CloneNotSupportedException {
final Plot p = (Plot) super.clone();
if (!p.equals(this) || (p != this)) {
return new Plot(this.id, this.owner, this.helpers, this.trusted, this.denied, this.settings.getAlias(), this.settings.getPosition(), this.settings.flags, getWorld().getName(), this.settings.getMerged());
return new Plot(this.id, this.owner, this.helpers, this.trusted, this.denied, this.settings.getAlias(), this.settings.getPosition(), this.settings.flags, this.world, this.settings.getMerged());
}
return p;
}
@ -340,15 +267,6 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
this.trusted.remove(uuid);
}
/**
* Clear a plot
*
* @param plr initiator
*/
public void clear(final Player plr, final boolean isDelete) {
PlotHelper.clear(plr, this, isDelete);
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {

View File

@ -27,9 +27,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import org.bukkit.Chunk;
import org.bukkit.block.Biome;
import net.milkbowl.vault.economy.Economy;
import com.intellectualcrafters.plot.BukkitMain;
@ -466,7 +463,7 @@ import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
Runnable run = new Runnable() {
@Override
public void run() {
PlotHelper.setBiome(world, plot, Biome.FOREST);
PlotHelper.setBiome(world, plot, "FOREST");
runners.remove(plot);
TaskManager.runTask(whenDone);
AChunkManager.manager.update(location);
@ -535,13 +532,13 @@ import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
BlockManager.setBlocks(world, xl, yl, zl, ids, data);
}
public static void setBiome(final String world, final Plot plot, final Biome b) {
public static void setBiome(final String world, final Plot plot, final String biome) {
final int bottomX = getPlotBottomLoc(world, plot.id).getX() + 1;
final int topX = getPlotTopLoc(world, plot.id).getX();
final int bottomZ = getPlotBottomLoc(world, plot.id).getZ() + 1;
final int topZ = getPlotTopLoc(world, plot.id).getZ();
BukkitUtil.setBiome(world, bottomX, bottomZ, topX, topZ, b);
BukkitUtil.setBiome(world, bottomX, bottomZ, topX, topZ, biome);
}
public static int getHeighestBlock(final String world, final int x, final int z) {

View File

@ -4,7 +4,6 @@ import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;

View File

@ -91,7 +91,8 @@ public class BukkitUtil extends BlockManager {
}
}
public static void setBiome(String worldname, int pos1_x, int pos1_z, int pos2_x, int pos2_z, Biome b) {
public static void setBiome(String worldname, int pos1_x, int pos1_z, int pos2_x, int pos2_z, String biome) {
Biome b = Biome.valueOf(biome.toUpperCase());
World world = getWorld(worldname);
for (int x = pos1_x; x<= pos2_x; x++) {
for (int z = pos1_z; z<= pos2_z; z++) {