Add fixes to shizzle

This commit is contained in:
Sauilitired 2016-01-16 18:32:00 +01:00
parent 830a5111f4
commit faa9c10364
2 changed files with 33 additions and 71 deletions

View File

@ -8,6 +8,8 @@ import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.util.UUID;
@CommandDeclaration( @CommandDeclaration(
command = "grant", command = "grant",
category = CommandCategory.CLAIMING, category = CommandCategory.CLAIMING,
@ -18,7 +20,12 @@ import com.plotsquared.general.commands.CommandDeclaration;
public class Grant extends SubCommand { public class Grant extends SubCommand {
void grantPlayer(PlotPlayer plr, String enteredName) { void grantPlayer(PlotPlayer plr, String enteredName) {
PlotPlayer player = UUIDHandler.getPlayer(enteredName); PlotPlayer player;
if (enteredName.length() > 16) {
player = PlotPlayer.wrap(UUID.fromString(enteredName));
} else {
player = UUIDHandler.getPlayer(enteredName);
}
if (player == null) { if (player == null) {
sendMessage(plr, C.GRANTED_PLOT_FAILED, "Player not found"); sendMessage(plr, C.GRANTED_PLOT_FAILED, "Player not found");
} else { } else {

View File

@ -1,27 +1,5 @@
package com.plotsquared.bukkit; package com.plotsquared.bukkit;
import java.io.File;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import com.intellectualcrafters.configuration.ConfigurationSection; import com.intellectualcrafters.configuration.ConfigurationSection;
import com.intellectualcrafters.plot.IPlotMain; import com.intellectualcrafters.plot.IPlotMain;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
@ -34,22 +12,7 @@ import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.object.SetupObject; import com.intellectualcrafters.plot.object.SetupObject;
import com.intellectualcrafters.plot.util.AbstractTitle; import com.intellectualcrafters.plot.util.*;
import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.BlockUpdateUtil;
import com.intellectualcrafters.plot.util.ChatManager;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.ConsoleColors;
import com.intellectualcrafters.plot.util.EconHandler;
import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.InventoryUtil;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.SchematicHandler;
import com.intellectualcrafters.plot.util.SetupUtils;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.util.UUIDHandlerImplementation;
import com.intellectualcrafters.plot.uuid.UUIDWrapper; import com.intellectualcrafters.plot.uuid.UUIDWrapper;
import com.plotsquared.bukkit.database.plotme.ClassicPlotMeConnector; import com.plotsquared.bukkit.database.plotme.ClassicPlotMeConnector;
import com.plotsquared.bukkit.database.plotme.LikePlotMeConverter; import com.plotsquared.bukkit.database.plotme.LikePlotMeConverter;
@ -57,40 +20,28 @@ import com.plotsquared.bukkit.database.plotme.PlotMeConnector_017;
import com.plotsquared.bukkit.generator.BukkitGeneratorWrapper; import com.plotsquared.bukkit.generator.BukkitGeneratorWrapper;
import com.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
import com.plotsquared.bukkit.generator.HybridGen; import com.plotsquared.bukkit.generator.HybridGen;
import com.plotsquared.bukkit.listeners.ChunkListener; import com.plotsquared.bukkit.listeners.*;
import com.plotsquared.bukkit.listeners.ForceFieldListener;
import com.plotsquared.bukkit.listeners.PlayerEvents;
import com.plotsquared.bukkit.listeners.PlayerEvents_1_8;
import com.plotsquared.bukkit.listeners.PlayerEvents_1_8_3;
import com.plotsquared.bukkit.listeners.PlotPlusListener;
import com.plotsquared.bukkit.listeners.WorldEvents;
import com.plotsquared.bukkit.listeners.worldedit.WEListener; import com.plotsquared.bukkit.listeners.worldedit.WEListener;
import com.plotsquared.bukkit.titles.DefaultTitle; import com.plotsquared.bukkit.titles.DefaultTitle;
import com.plotsquared.bukkit.util.BukkitChatManager; import com.plotsquared.bukkit.util.*;
import com.plotsquared.bukkit.util.BukkitChunkManager; import com.plotsquared.bukkit.uuid.*;
import com.plotsquared.bukkit.util.BukkitCommand;
import com.plotsquared.bukkit.util.BukkitEconHandler;
import com.plotsquared.bukkit.util.BukkitEventUtil;
import com.plotsquared.bukkit.util.BukkitHybridUtils;
import com.plotsquared.bukkit.util.BukkitInventoryUtil;
import com.plotsquared.bukkit.util.BukkitPlainChatManager;
import com.plotsquared.bukkit.util.BukkitSchematicHandler;
import com.plotsquared.bukkit.util.BukkitSetBlockManager;
import com.plotsquared.bukkit.util.BukkitSetupUtils;
import com.plotsquared.bukkit.util.BukkitTaskManager;
import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.bukkit.util.Metrics;
import com.plotsquared.bukkit.util.SendChunk;
import com.plotsquared.bukkit.util.SetBlockFast;
import com.plotsquared.bukkit.util.SetBlockFast_1_8;
import com.plotsquared.bukkit.util.SetBlockSlow;
import com.plotsquared.bukkit.util.SetGenCB;
import com.plotsquared.bukkit.uuid.DefaultUUIDWrapper;
import com.plotsquared.bukkit.uuid.FileUUIDHandler;
import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
import com.plotsquared.bukkit.uuid.SQLUUIDHandler;
import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import org.bukkit.*;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
public class BukkitMain extends JavaPlugin implements Listener, IPlotMain { public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
@ -633,7 +584,11 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
} else if (obj instanceof String) { } else if (obj instanceof String) {
return UUIDHandler.getPlayer((String) obj); return UUIDHandler.getPlayer((String) obj);
} else if (obj instanceof UUID) { } else if (obj instanceof UUID) {
return UUIDHandler.getPlayer((UUID) obj); PlotPlayer player = UUIDHandler.getPlayer((UUID) obj);
if (player == null) {
return BukkitUtil.getPlayer(Bukkit.getOfflinePlayer((UUID) obj));
}
return player;
} }
return null; return null;
} }