mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-28 11:44:42 +02:00
Yup.
This commit is contained in:
@ -728,8 +728,8 @@ public class PlotMain extends JavaPlugin {
|
||||
PlotHelper.canSetFast = false;
|
||||
}
|
||||
|
||||
|
||||
// UUIDHandler.startFetch(this);
|
||||
//TODO Test...
|
||||
UUIDHandler.startFetch(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,11 +1,14 @@
|
||||
package com.intellectualcrafters.plot;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.intellectualcrafters.plot.uuid.NameFetcher;
|
||||
import com.intellectualcrafters.plot.uuid.UUIDFetcher;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@ -71,7 +74,13 @@ public class UUIDHandler {
|
||||
return uuid;
|
||||
}
|
||||
if(Bukkit.getOnlineMode()) {
|
||||
/* TODO: Add mojang API support */
|
||||
try {
|
||||
UUIDFetcher fetcher = new UUIDFetcher(Arrays.asList(name));
|
||||
uuid = fetcher.call().get(name);
|
||||
add(name, uuid);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
return getUuidOfflineMode(name);
|
||||
}
|
||||
@ -108,7 +117,19 @@ public class UUIDHandler {
|
||||
if ((name = getNameOfflinePlayer(uuid)) != null) {
|
||||
return name;
|
||||
}
|
||||
return null;
|
||||
if (Bukkit.getOnlineMode()) {
|
||||
try {
|
||||
NameFetcher fetcher = new NameFetcher(Arrays.asList(uuid));
|
||||
name = fetcher.call().get(uuid);
|
||||
add(name, uuid);
|
||||
return name;
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
return "unknown";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9,17 +9,17 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlayerPlotDeniedEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlayerPlotDeniedEvent;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created by Citymonstret on 2014-08-03.
|
||||
@ -72,7 +72,7 @@ public class Denied extends SubCommand {
|
||||
PlayerFunctions.sendMessage(plr, C.DENIED_ADDED);
|
||||
return true;
|
||||
}
|
||||
if (!hasBeenOnServer(args[1])) {
|
||||
/*if (!hasBeenOnServer(args[1])) {
|
||||
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||
return true;
|
||||
}
|
||||
@ -85,7 +85,8 @@ public class Denied extends SubCommand {
|
||||
if (uuid == null) {
|
||||
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||
plot.addDenied(uuid);
|
||||
DBFunc.setDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
|
||||
PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true);
|
||||
@ -110,7 +111,7 @@ public class Denied extends SubCommand {
|
||||
PlayerFunctions.sendMessage(plr, C.DENIED_REMOVED);
|
||||
return true;
|
||||
}
|
||||
if (!hasBeenOnServer(args[1])) {
|
||||
/*if (!hasBeenOnServer(args[1])) {
|
||||
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||
return true;
|
||||
}
|
||||
@ -127,7 +128,8 @@ public class Denied extends SubCommand {
|
||||
if (uuid == null) {
|
||||
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||
plot.removeDenied(uuid);
|
||||
DBFunc.removeDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
|
||||
PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, false);
|
||||
|
@ -9,17 +9,17 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlayerPlotHelperEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlayerPlotHelperEvent;
|
||||
import java.util.UUID;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class Helpers extends SubCommand {
|
||||
@ -69,7 +69,7 @@ public class Helpers extends SubCommand {
|
||||
PlayerFunctions.sendMessage(plr, C.HELPER_ADDED);
|
||||
return true;
|
||||
}
|
||||
if (!hasBeenOnServer(args[1])) {
|
||||
/*if (!hasBeenOnServer(args[1])) {
|
||||
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||
return true;
|
||||
}
|
||||
@ -82,7 +82,8 @@ public class Helpers extends SubCommand {
|
||||
if (uuid == null) {
|
||||
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||
plot.addHelper(uuid);
|
||||
DBFunc.setHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
|
||||
PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true);
|
||||
@ -100,7 +101,7 @@ public class Helpers extends SubCommand {
|
||||
PlayerFunctions.sendMessage(plr, C.HELPER_REMOVED);
|
||||
return true;
|
||||
}
|
||||
if (!hasBeenOnServer(args[1])) {
|
||||
/*if (!hasBeenOnServer(args[1])) {
|
||||
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||
return true;
|
||||
}
|
||||
@ -117,7 +118,8 @@ public class Helpers extends SubCommand {
|
||||
if (!plot.helpers.contains(uuid)) {
|
||||
PlayerFunctions.sendMessage(plr, C.WAS_NOT_ADDED);
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||
plot.removeHelper(uuid);
|
||||
DBFunc.removeHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
|
||||
PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, false);
|
||||
|
@ -9,22 +9,17 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.PlotHelper;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -125,11 +120,13 @@ public class Info extends SubCommand {
|
||||
if (uuid.equals(DBFunc.everyone) || uuid.toString().equalsIgnoreCase(DBFunc.everyone.toString())) {
|
||||
return "everyone";
|
||||
}
|
||||
/*
|
||||
OfflinePlayer plr = Bukkit.getOfflinePlayer(uuid);
|
||||
if (plr.getName() == null) {
|
||||
return "unknown";
|
||||
}
|
||||
return plr.getName();
|
||||
return plr.getName();*/
|
||||
return UUIDHandler.getName(uuid);
|
||||
}
|
||||
|
||||
private Biome getBiomeAt(Plot plot) {
|
||||
|
@ -9,17 +9,11 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import java.util.UUID;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class SetOwner extends SubCommand {
|
||||
@ -28,9 +22,14 @@ public class SetOwner extends SubCommand {
|
||||
super("setowner", "plots.admin", "Set the plot owner", "setowner {player}", "so", CommandCategory.ACTIONS);
|
||||
}
|
||||
|
||||
/*
|
||||
private UUID getUUID(String string) {
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(string);
|
||||
return ((player != null) && player.hasPlayedBefore()) ? player.getUniqueId() : null;
|
||||
}*/
|
||||
|
||||
private UUID getUUID(String string) {
|
||||
return UUIDHandler.getUUID(string);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -9,17 +9,17 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlayerPlotTrustedEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlayerPlotTrustedEvent;
|
||||
import java.util.UUID;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class Trusted extends SubCommand {
|
||||
@ -69,7 +69,7 @@ public class Trusted extends SubCommand {
|
||||
PlayerFunctions.sendMessage(plr, C.TRUSTED_ADDED);
|
||||
return true;
|
||||
}
|
||||
if (!hasBeenOnServer(args[1])) {
|
||||
/*if (!hasBeenOnServer(args[1])) {
|
||||
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||
return true;
|
||||
}
|
||||
@ -82,7 +82,8 @@ public class Trusted extends SubCommand {
|
||||
if (uuid == null) {
|
||||
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||
plot.addTrusted(uuid);
|
||||
DBFunc.setTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
|
||||
PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true);
|
||||
@ -100,6 +101,7 @@ public class Trusted extends SubCommand {
|
||||
PlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED);
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
if (!hasBeenOnServer(args[1])) {
|
||||
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||
return true;
|
||||
@ -117,7 +119,8 @@ public class Trusted extends SubCommand {
|
||||
if (!plot.trusted.contains(uuid)) {
|
||||
PlayerFunctions.sendMessage(plr, C.T_WAS_NOT_ADDED);
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||
plot.removeTrusted(uuid);
|
||||
DBFunc.removeTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
|
||||
PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, false);
|
||||
|
@ -9,18 +9,12 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.PlotId;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -97,11 +91,12 @@ public class list extends SubCommand {
|
||||
if (id == null) {
|
||||
return "none";
|
||||
}
|
||||
String name = Bukkit.getOfflinePlayer(id).getName();
|
||||
/*String name = Bukkit.getOfflinePlayer(id).getName();
|
||||
if (name == null) {
|
||||
return "none";
|
||||
}
|
||||
return name;
|
||||
return name;*/
|
||||
return UUIDHandler.getName(id);
|
||||
}
|
||||
|
||||
private String getArgumentList(String[] strings) {
|
||||
|
Reference in New Issue
Block a user