This commit is contained in:
boy0001 2014-10-21 20:58:52 +11:00
parent 3bbd0a2293
commit c55faaec8d
13 changed files with 192 additions and 188 deletions

View File

@ -110,7 +110,7 @@ public enum C {
* Permission
*/
NO_SCHEMATIC_PERMISSION("&cYou don't have the permission required to use schematic &6%s"),
NO_PERMISSION("&cYou don't have the permissions required to use this command."),
NO_PERMISSION("&cYou are lacking the permission node: &6%s"),
NO_PLOT_PERMS("&cYou don't have the permissions to do that in this plot"),
CANT_CLAIM_MORE_PLOTS("&cYou can't claim more plots."),
YOU_BE_DENIED("&cYou are not allowed to enter this plot"),
@ -216,7 +216,7 @@ public enum C {
/*
* Claiming
*/
PLOT_NOT_CLAIMED("&cCannot claim plot"),
PLOT_NOT_CLAIMED("&cPlot not claimed"),
PLOT_IS_CLAIMED("&cThis plot is already claimed"),
CLAIMED("&6You successfully claimed the plot"),
/*

View File

@ -6,7 +6,6 @@ public abstract class PlotGenerator extends ChunkGenerator {
public PlotGenerator(String world) {
PlotMain.loadWorld(world, this);
System.out.print("LOADED");
}
public abstract PlotWorld getNewPlotWorld(String world);

View File

@ -0,0 +1,34 @@
package com.intellectualcrafters.plot;
public class StringWrapper {
public String value;
public StringWrapper(String value) {
this.value = value;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
StringWrapper other = (StringWrapper) obj;
return other.value.toLowerCase().equals(this.value.toLowerCase());
}
@Override
public String toString() {
return this.value;
}
@Override
public int hashCode() {
return this.value.toLowerCase().hashCode();
}
}

View File

@ -6,11 +6,13 @@ import com.google.common.collect.HashBiMap;
import com.intellectualcrafters.plot.uuid.NameFetcher;
import com.intellectualcrafters.plot.uuid.UUIDFetcher;
import com.intellectualcrafters.plot.uuid.UUIDSaver;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.HashMap;
import java.util.UUID;
/**
@ -35,9 +37,9 @@ public class UUIDHandler {
private static boolean online = Bukkit.getServer().getOnlineMode();
private static BiMap<String, UUID> uuidMap = HashBiMap.create();
private static BiMap<StringWrapper, UUID> uuidMap = HashBiMap.create(new HashMap<StringWrapper, UUID>());
public static BiMap<String, UUID> getUuidMap() {
public static BiMap<StringWrapper, UUID> getUuidMap() {
return uuidMap;
}
@ -45,42 +47,45 @@ public class UUIDHandler {
return uuidMap.containsValue(uuid);
}
public static boolean nameExists(String name) {
public static boolean nameExists(StringWrapper name) {
return uuidMap.containsKey(name);
}
public static void add(String name, UUID uuid) {
public static void add(StringWrapper name, UUID uuid) {
uuidMap.put(name, uuid);
}
/**
* @param name
* @return uuid
*/
public static UUID getUUID(String name) {
if (nameExists(name)) {
return uuidMap.get(name);
StringWrapper nameWrap = new StringWrapper(name);
if (uuidMap.containsKey(nameWrap)) {
return uuidMap.get(nameWrap);
}
Player player = Bukkit.getPlayer(name);
if (player!=null) {
UUID uuid = player.getUniqueId();
uuidMap.put(nameWrap, uuid);
return uuid;
}
UUID uuid;
if ((uuid = getUuidOnlinePlayer(name)) != null) {
return uuid;
}
if ((uuid = getUuidOfflinePlayer(name)) != null) {
return uuid;
}
if (online) {
if ((uuid = getUuidOnlinePlayer(nameWrap)) != null) {
return uuid;
}
try {
UUIDFetcher fetcher = new UUIDFetcher(Arrays.asList(name));
uuid = fetcher.call().get(name);
add(name, uuid);
add(nameWrap, uuid);
}
catch (Exception e) {
e.printStackTrace();
}
}
else {
return getUuidOfflineMode(name);
return getUuidOfflineMode(nameWrap);
}
return null;
}
@ -89,7 +94,7 @@ public class UUIDHandler {
* @param uuid
* @return name (cache)
*/
private static String loopSearch(UUID uuid) {
private static StringWrapper loopSearch(UUID uuid) {
return uuidMap.inverse().get(uuid);
}
@ -99,7 +104,7 @@ public class UUIDHandler {
*/
public static String getName(UUID uuid) {
if (uuidExists(uuid)) {
return loopSearch(uuid);
return loopSearch(uuid).value;
}
String name;
if ((name = getNameOnlinePlayer(uuid)) != null) {
@ -112,7 +117,7 @@ public class UUIDHandler {
try {
NameFetcher fetcher = new NameFetcher(Arrays.asList(uuid));
name = fetcher.call().get(uuid);
add(name, uuid);
add(new StringWrapper(name), uuid);
return name;
}
catch (Exception e) {
@ -129,7 +134,7 @@ public class UUIDHandler {
* @param name
* @return UUID (name hash)
*/
private static UUID getUuidOfflineMode(String name) {
private static UUID getUuidOfflineMode(StringWrapper name) {
UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8));
add(name, uuid);
return uuid;
@ -145,7 +150,7 @@ public class UUIDHandler {
return null;
}
String name = player.getName();
add(name, uuid);
add(new StringWrapper(name), uuid);
return name;
}
@ -159,7 +164,7 @@ public class UUIDHandler {
return null;
}
String name = player.getName();
add(name, uuid);
add(new StringWrapper(name), uuid);
return name;
}
@ -167,9 +172,9 @@ public class UUIDHandler {
* @param name
* @return UUID
*/
private static UUID getUuidOnlinePlayer(String name) {
Player player = Bukkit.getPlayer(name);
if (player == null || !player.isOnline()) {
private static UUID getUuidOnlinePlayer(StringWrapper name) {
Player player = Bukkit.getPlayer(name.value);
if (player == null) {
return null;
}
UUID uuid = player.getUniqueId();
@ -181,8 +186,8 @@ public class UUIDHandler {
* @param name
* @return UUID (username hash)
*/
private static UUID getUuidOfflinePlayer(String name) {
UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8));
private static UUID getUuidOfflinePlayer(StringWrapper name) {
UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name.value).getBytes(Charsets.UTF_8));
add(name, uuid);
return uuid;
}

View File

@ -23,7 +23,7 @@ public class CommandPermission {
/**
*
*/
private String permission;
public String permission;
/**
* @param permission

View File

@ -42,61 +42,49 @@ public class Denied extends SubCommand {
}
Plot plot = PlayerFunctions.getCurrentPlot(plr);
if ((plot.owner == null) || !plot.hasRights(plr)) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION);
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
return true;
}
if (args[0].equalsIgnoreCase("add")) {
UUID uuid;
if (args[1].equalsIgnoreCase("*")) {
UUID uuid = DBFunc.everyone;
if (!plot.denied.contains(uuid)) {
if (plot.owner == uuid) {
PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
return false;
}
if (plot.trusted.contains(uuid)) {
plot.trusted.remove(uuid);
DBFunc.removeTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(uuid));
}
if (plot.helpers.contains(uuid)) {
plot.helpers.remove(uuid);
DBFunc.removeHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(uuid));
}
plot.addDenied(uuid);
DBFunc.setDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event);
}
else {
PlayerFunctions.sendMessage(plr, C.ALREADY_ADDED);
uuid = DBFunc.everyone;
}
else {
uuid = UUIDHandler.getUUID(args[1]);
}
if (!plot.denied.contains(uuid)) {
if (plot.owner == uuid) {
PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
return false;
}
PlayerFunctions.sendMessage(plr, C.DENIED_ADDED);
return true;
}
/*
* if (!hasBeenOnServer(args[1])) { PlayerFunctions.sendMessage(plr,
* C.PLAYER_HAS_NOT_BEEN_ON); return true; } UUID uuid = null; if
* ((Bukkit.getPlayer(args[1]) != null)) { uuid =
* Bukkit.getPlayer(args[1]).getUniqueId(); } else { uuid =
* Bukkit.getOfflinePlayer(args[1]).getUniqueId(); } if (uuid ==
* null) { PlayerFunctions.sendMessage(plr,
* C.PLAYER_HAS_NOT_BEEN_ON); return true; }
*/
UUID uuid = UUIDHandler.getUUID(args[1]);
if (!plot.denied.contains(uuid)) {
plot.addDenied(uuid);
DBFunc.setDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event);
}
PlayerFunctions.sendMessage(plr, C.DENIED_ADDED);
if ((Bukkit.getPlayer(uuid) != null) && Bukkit.getPlayer(uuid).isOnline()) {
if (plot.trusted.contains(uuid)) {
plot.trusted.remove(uuid);
DBFunc.removeTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(uuid));
}
if (plot.helpers.contains(uuid)) {
plot.helpers.remove(uuid);
DBFunc.removeHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(uuid));
}
plot.addDenied(uuid);
DBFunc.setDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event);
}
else {
PlayerFunctions.sendMessage(plr, C.ALREADY_ADDED);
return false;
}
if (!uuid.equals(DBFunc.everyone) && (Bukkit.getPlayer(uuid) != null) && Bukkit.getPlayer(uuid).isOnline()) {
Plot pl = PlayerFunctions.getCurrentPlot(Bukkit.getPlayer((uuid)));
if (pl.id == plot.id) {
PlayerFunctions.sendMessage(Bukkit.getPlayer(uuid), C.YOU_BE_DENIED);
Bukkit.getPlayer(uuid).teleport(Bukkit.getPlayer(uuid).getWorld().getSpawnLocation());
}
}
PlayerFunctions.sendMessage(plr, C.DENIED_ADDED);
return true;
}
else
if (args[0].equalsIgnoreCase("remove")) {

View File

@ -39,54 +39,41 @@ public class Helpers extends SubCommand {
}
Plot plot = PlayerFunctions.getCurrentPlot(plr);
if ((plot.owner == null) || !plot.hasRights(plr)) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION);
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
return true;
}
if (args[0].equalsIgnoreCase("add")) {
UUID uuid;
if (args[1].equalsIgnoreCase("*")) {
UUID uuid = DBFunc.everyone;
if (!plot.helpers.contains(uuid)) {
if (plot.owner == uuid) {
PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
return false;
}
if (plot.trusted.contains(uuid)) {
plot.trusted.remove(uuid);
DBFunc.removeTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(uuid));
}
if (plot.denied.contains(uuid)) {
plot.denied.remove(uuid);
DBFunc.removeDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(uuid));
}
plot.addHelper(uuid);
DBFunc.setHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event);
}
else {
PlayerFunctions.sendMessage(plr, C.ALREADY_ADDED);
uuid = DBFunc.everyone;
}
else {
uuid = UUIDHandler.getUUID(args[1]);
}
if (!plot.helpers.contains(uuid)) {
if (plot.owner == uuid) {
PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
return false;
}
PlayerFunctions.sendMessage(plr, C.HELPER_ADDED);
return true;
}
/*
* if (!hasBeenOnServer(args[1])) { PlayerFunctions.sendMessage(plr,
* C.PLAYER_HAS_NOT_BEEN_ON); return true; } UUID uuid = null; if
* ((Bukkit.getPlayer(args[1]) != null)) { uuid =
* Bukkit.getPlayer(args[1]).getUniqueId(); } else { uuid =
* Bukkit.getOfflinePlayer(args[1]).getUniqueId(); } if (uuid ==
* null) { PlayerFunctions.sendMessage(plr,
* C.PLAYER_HAS_NOT_BEEN_ON); return true; }
*/
UUID uuid = UUIDHandler.getUUID(args[1]);
if (!plot.helpers.contains(uuid)) {
plot.addHelper(uuid);
DBFunc.setHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event);
}
PlayerFunctions.sendMessage(plr, C.HELPER_ADDED);
if (plot.trusted.contains(uuid)) {
plot.trusted.remove(uuid);
DBFunc.removeTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(uuid));
}
if (plot.denied.contains(uuid)) {
plot.denied.remove(uuid);
DBFunc.removeDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(uuid));
}
plot.addHelper(uuid);
DBFunc.setHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event);
}
else {
PlayerFunctions.sendMessage(plr, C.ALREADY_ADDED);
return false;
}
PlayerFunctions.sendMessage(plr, C.HELPER_ADDED);
return true;
}
else
if (args[0].equalsIgnoreCase("remove")) {

View File

@ -38,8 +38,8 @@ public class MainCommand implements CommandExecutor {
}
};
public static boolean no_permission(Player player) {
PlayerFunctions.sendMessage(player, C.NO_PERMISSION);
public static boolean no_permission(Player player, String permission) {
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, permission);
return false;
}
@ -53,7 +53,7 @@ public class MainCommand implements CommandExecutor {
player = null;
}
if (!PlotMain.hasPermission(player, "plots.use")) {
return no_permission(player);
return no_permission(player, "plots.use");
}
if ((args.length < 1)
|| ((args.length >= 1) && (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("he")))) {
@ -109,7 +109,7 @@ public class MainCommand implements CommandExecutor {
}
}
else {
return no_permission(player);
return no_permission(player, command.permission.permission.toLowerCase());
}
}
}

View File

@ -48,7 +48,7 @@ public class Set extends SubCommand {
Plot plot = PlayerFunctions.getCurrentPlot(plr);
if(!plot.hasOwner()) {
sendMessage(plr, C.PLOT_NOT_CLAIMED);
return true;
return false;
}
if (!plot.hasRights(plr) && !plr.hasPermission("plots.admin")) {
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
@ -71,7 +71,7 @@ public class Set extends SubCommand {
boolean advanced_permissions = true;
if (advanced_permissions) {
if (!plr.hasPermission("plots.set." + args[0].toLowerCase())) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION);
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.set."+args[0].toLowerCase());
return false;
}
}
@ -104,7 +104,7 @@ public class Set extends SubCommand {
PlayerFunctions.sendMessage(plr, C.NOT_VALID_FLAG);
return false;
}
if (!plr.hasPermission("plots.set.flag." + args[1].toLowerCase())) {
if (!PlotMain.hasPermission(plr, "plots.set.flag." + args[1].toLowerCase())) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION);
return false;
}

View File

@ -39,54 +39,42 @@ public class Trusted extends SubCommand {
}
Plot plot = PlayerFunctions.getCurrentPlot(plr);
if ((plot.owner == null) || !plot.hasRights(plr)) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION);
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
return true;
}
if (args[0].equalsIgnoreCase("add")) {
UUID uuid;
if (args[1].equalsIgnoreCase("*")) {
UUID uuid = DBFunc.everyone;
if (!plot.trusted.contains(uuid)) {
if (plot.owner == uuid) {
PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
return false;
}
if (plot.helpers.contains(uuid)) {
plot.helpers.remove(uuid);
DBFunc.removeHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(uuid));
}
if (plot.denied.contains(uuid)) {
plot.denied.remove(uuid);
DBFunc.removeDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(uuid));
}
plot.addTrusted(uuid);
DBFunc.setTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event);
}
else {
PlayerFunctions.sendMessage(plr, C.ALREADY_ADDED);
return false;
}
PlayerFunctions.sendMessage(plr, C.TRUSTED_ADDED);
return true;
uuid = DBFunc.everyone;
}
else {
uuid = UUIDHandler.getUUID(args[1]);
}
/*
* if (!hasBeenOnServer(args[1])) { PlayerFunctions.sendMessage(plr,
* C.PLAYER_HAS_NOT_BEEN_ON); return true; } UUID uuid = null; if
* ((Bukkit.getPlayer(args[1]) != null)) { uuid =
* Bukkit.getPlayer(args[1]).getUniqueId(); } else { uuid =
* Bukkit.getOfflinePlayer(args[1]).getUniqueId(); } if (uuid ==
* null) { PlayerFunctions.sendMessage(plr,
* C.PLAYER_HAS_NOT_BEEN_ON); return true; }
*/
UUID uuid = UUIDHandler.getUUID(args[1]);
if (!plot.trusted.contains(uuid)) {
plot.addTrusted(uuid);
DBFunc.setTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event);
}
PlayerFunctions.sendMessage(plr, C.TRUSTED_ADDED);
if (plot.owner == uuid) {
PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
return false;
}
if (plot.helpers.contains(uuid)) {
plot.helpers.remove(uuid);
DBFunc.removeHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(uuid));
}
if (plot.denied.contains(uuid)) {
plot.denied.remove(uuid);
DBFunc.removeDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(uuid));
}
plot.addTrusted(uuid);
DBFunc.setTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event);
}
else {
PlayerFunctions.sendMessage(plr, C.ALREADY_ADDED);
return false;
}
PlayerFunctions.sendMessage(plr, C.TRUSTED_ADDED);
return true;
}
else
if (args[0].equalsIgnoreCase("remove")) {

View File

@ -676,18 +676,18 @@ public class PlayerEvents implements Listener {
Block b = e.getBlockClicked().getLocation().add(bf.getModX(), bf.getModY(), bf.getModZ()).getBlock();
if (isPlotWorld(b.getLocation())) {
if (!isInPlot(b.getLocation())) {
PlayerFunctions.sendMessage(e.getPlayer(), C.NO_PERMISSION);
PlayerFunctions.sendMessage(e.getPlayer(), C.NO_PLOT_PERMS);
e.setCancelled(true);
}
else {
Plot plot = getCurrentPlot(b.getLocation());
if (plot == null) {
PlayerFunctions.sendMessage(e.getPlayer(), C.NO_PERMISSION);
PlayerFunctions.sendMessage(e.getPlayer(), C.NO_PLOT_PERMS);
e.setCancelled(true);
}
else
if (!plot.hasRights(e.getPlayer())) {
PlayerFunctions.sendMessage(e.getPlayer(), C.NO_PERMISSION);
PlayerFunctions.sendMessage(e.getPlayer(), C.NO_PLOT_PERMS);
e.setCancelled(true);
}
}
@ -720,18 +720,18 @@ public class PlayerEvents implements Listener {
Block b = e.getBlockClicked();
if (isPlotWorld(b.getLocation())) {
if (!isInPlot(b.getLocation())) {
PlayerFunctions.sendMessage(e.getPlayer(), C.NO_PERMISSION);
PlayerFunctions.sendMessage(e.getPlayer(), C.NO_PLOT_PERMS);
e.setCancelled(true);
}
else {
Plot plot = getCurrentPlot(b.getLocation());
if (plot == null) {
PlayerFunctions.sendMessage(e.getPlayer(), C.NO_PERMISSION);
PlayerFunctions.sendMessage(e.getPlayer(), C.NO_PLOT_PERMS);
e.setCancelled(true);
}
else
if (!plot.hasRights(e.getPlayer())) {
PlayerFunctions.sendMessage(e.getPlayer(), C.NO_PERMISSION);
PlayerFunctions.sendMessage(e.getPlayer(), C.NO_PLOT_PERMS);
e.setCancelled(true);
}
}
@ -747,7 +747,7 @@ public class PlayerEvents implements Listener {
Player p = e.getPlayer();
if (!isInPlot(b.getLocation())) {
if (!p.hasPermission("plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION);
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
}
}
@ -755,14 +755,14 @@ public class PlayerEvents implements Listener {
Plot plot = getCurrentPlot(b.getLocation());
if (plot == null) {
if (!p.hasPermission("plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION);
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
}
}
else
if (!plot.hasRights(p)) {
if (!p.hasPermission("plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION);
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
}
}
@ -780,7 +780,7 @@ public class PlayerEvents implements Listener {
if (isPlotWorld(l)) {
if (!isInPlot(l)) {
if (!p.hasPermission("plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION);
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
}
}
@ -788,14 +788,14 @@ public class PlayerEvents implements Listener {
Plot plot = getCurrentPlot(l);
if (plot == null) {
if (!p.hasPermission("plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION);
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
}
}
else
if (!plot.hasRights(p)) {
if (!p.hasPermission("plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION);
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
}
}
@ -812,7 +812,7 @@ public class PlayerEvents implements Listener {
Player p = e.getPlayer();
if (!isInPlot(l)) {
if (!p.hasPermission("plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION);
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
}
}
@ -820,14 +820,14 @@ public class PlayerEvents implements Listener {
Plot plot = getCurrentPlot(l);
if (plot == null) {
if (!p.hasPermission("plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION);
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
}
}
else
if (!plot.hasRights(p)) {
if (!p.hasPermission("plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION);
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
}
}
@ -853,7 +853,7 @@ public class PlayerEvents implements Listener {
}
if (!isInPlot(l)) {
if (!p.hasPermission("plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION);
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
}
}
@ -861,14 +861,14 @@ public class PlayerEvents implements Listener {
Plot plot = getCurrentPlot(l);
if (plot == null) {
if (!p.hasPermission("plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION);
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
}
}
else
if (!plot.hasRights(p)) {
if (!p.hasPermission("plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION);
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
}
}
@ -885,7 +885,7 @@ public class PlayerEvents implements Listener {
Player p = e.getPlayer();
if (!isInPlot(l)) {
if (!p.hasPermission("plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION);
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setHatching(false);
}
}
@ -893,14 +893,14 @@ public class PlayerEvents implements Listener {
Plot plot = getCurrentPlot(l);
if (plot == null) {
if (!p.hasPermission("plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION);
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setHatching(false);
}
}
else
if (!plot.hasRights(p)) {
if (!p.hasPermission("plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION);
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setHatching(false);
}
}

View File

@ -2,7 +2,9 @@ package com.intellectualcrafters.plot.uuid;
import com.google.common.collect.BiMap;
import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.StringWrapper;
import com.intellectualcrafters.plot.UUIDHandler;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.plugin.java.JavaPlugin;
@ -28,7 +30,7 @@ public class PlotUUIDSaver extends UUIDSaver {
uuid = player.getUniqueId();
if (!UUIDHandler.uuidExists(uuid)) {
name = player.getName();
UUIDHandler.add(name, uuid);
UUIDHandler.add(new StringWrapper(name), uuid);
}
}
@ -49,7 +51,7 @@ public class PlotUUIDSaver extends UUIDSaver {
});
}
public void globalSave(BiMap<String, UUID> map) {
public void globalSave(BiMap<StringWrapper, UUID> map) {
}

View File

@ -1,6 +1,7 @@
package com.intellectualcrafters.plot.uuid;
import com.google.common.collect.BiMap;
import com.intellectualcrafters.plot.StringWrapper;
import java.util.UUID;
@ -9,7 +10,7 @@ import java.util.UUID;
*/
public abstract class UUIDSaver {
public abstract void globalPopulate();
public abstract void globalSave(BiMap<String, UUID> map);
public abstract void globalSave(BiMap<StringWrapper, UUID> biMap);
public abstract void save(UUIDSet set);
public abstract UUIDSet get(String name);
public abstract UUIDSet get(UUID uuid);