Merge pull request #33 from riking/style

Style fixes
This commit is contained in:
libraryaddict 2014-06-15 13:34:21 +12:00
commit 57be672b1b
6 changed files with 23 additions and 21 deletions

View File

@ -45,7 +45,7 @@ public class DisguiseListener implements Listener {
updateNotifyPermission = plugin.getConfig().getString("Permission");
if (plugin.getConfig().getBoolean("NotifyUpdate")) {
currentVersion = plugin.getDescription().getVersion();
Bukkit.getScheduler().scheduleAsyncRepeatingTask(plugin, new Runnable() {
Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() {
public void run() {
try {
UpdateChecker updateChecker = new UpdateChecker();
@ -53,7 +53,7 @@ public class DisguiseListener implements Listener {
latestVersion = updateChecker.getLatestVersion();
if (latestVersion != null) {
latestVersion = "v" + latestVersion;
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
Bukkit.getScheduler().runTask(plugin, new Runnable() {
public void run() {
for (Player p : Bukkit.getOnlinePlayers())
if (p.hasPermission(updateNotifyPermission))
@ -239,7 +239,7 @@ public class DisguiseListener implements Listener {
if (event.getExited() instanceof Player) {
final Disguise disguise = DisguiseAPI.getDisguise((Player) event.getExited(), event.getExited());
if (disguise != null) {
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
Bukkit.getScheduler().runTask(plugin, new Runnable() {
public void run() {
DisguiseUtilities.setupFakeDisguise(disguise);
((Player) disguise.getEntity()).updateInventory();

View File

@ -28,12 +28,12 @@ public class DisguiseCloneCommand extends BaseDisguiseCommand {
return true;
}
if (sender.hasPermission("libsdisguises.disguise.disguiseclone")) {
boolean doEnquipment = true;
boolean doEquipment = true;
boolean doSneak = false;
boolean doSprint = false;
for (String option : args) {
if (StringUtils.startsWithIgnoreCase(option, "ignoreEnquip")) {
doEnquipment = false;
if (StringUtils.startsWithIgnoreCase(option, "ignoreEquip") || StringUtils.startsWithIgnoreCase(option, "ignoreEnquip")) {
doEquipment = false;
} else if (option.equalsIgnoreCase("doSneakSprint")) {
doSneak = true;
doSprint = true;
@ -43,11 +43,11 @@ public class DisguiseCloneCommand extends BaseDisguiseCommand {
doSprint = true;
} else {
sender.sendMessage(ChatColor.DARK_RED + "Unknown option '" + option
+ "' - Valid options are 'IgnoreEnquipment' 'DoSneakSprint' 'DoSneak' 'DoSprint'");
+ "' - Valid options are 'IgnoreEquipment' 'DoSneakSprint' 'DoSneak' 'DoSprint'");
return true;
}
}
listener.setDisguiseClone(sender.getName(), new Boolean[] { doEnquipment, doSneak, doSprint });
listener.setDisguiseClone(sender.getName(), new Boolean[] { doEquipment, doSneak, doSprint });
sender.sendMessage(ChatColor.RED + "Right click a entity in the next " + DisguiseConfig.getDisguiseCloneExpire()
+ " seconds to grab the disguise reference!");
} else {
@ -62,8 +62,8 @@ public class DisguiseCloneCommand extends BaseDisguiseCommand {
protected void sendCommandUsage(CommandSender sender, HashMap<DisguiseType, HashMap<ArrayList<String>, Boolean>> map) {
sender.sendMessage(ChatColor.DARK_GREEN
+ "Right click a entity to get a disguise reference you can pass to other disguise commands!");
sender.sendMessage(ChatColor.DARK_GREEN + "Beware however, the reference bypasses all permissions checks");
sender.sendMessage(ChatColor.DARK_GREEN + "/disguiseclone IgnoreEnquipment" + ChatColor.DARK_GREEN + "("
sender.sendMessage(ChatColor.DARK_GREEN + "Security note: Any references you create will be available to all players able to use disguise references.");
sender.sendMessage(ChatColor.DARK_GREEN + "/disguiseclone IgnoreEquipment" + ChatColor.DARK_GREEN + "("
+ ChatColor.GREEN + "Optional" + ChatColor.DARK_GREEN + ")");
}
}

View File

@ -10,6 +10,7 @@ public class LibsDisguisesCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
// TODO is public version disclosure a problem?
sender.sendMessage(ChatColor.DARK_GREEN
+ "This server is running "
+ "Lib's Disguises "

View File

@ -25,6 +25,7 @@ import org.bukkit.entity.Horse.Variant;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
import org.bukkit.util.Vector;
import com.comphenix.protocol.PacketType;
@ -45,7 +46,7 @@ public abstract class Disguise {
private boolean keepDisguisePlayerLogout = DisguiseConfig.isKeepDisguiseOnPlayerLogout();
private boolean modifyBoundingBox = DisguiseConfig.isModifyBoundingBox();
private boolean replaceSounds = DisguiseConfig.isSoundEnabled();
private int taskId = -1;
private BukkitTask task = null;
private Runnable velocityRunnable;
private boolean velocitySent = DisguiseConfig.isVelocitySent();
private boolean viewSelfDisguise = DisguiseConfig.isViewDisguises();
@ -188,8 +189,8 @@ public abstract class Disguise {
} else {
entity = null;
watcher = getWatcher().clone(disguise);
Bukkit.getScheduler().cancelTask(taskId);
taskId = -1;
task.cancel();
task = null;
}
}
} else {
@ -404,9 +405,9 @@ public abstract class Disguise {
public void removeDisguise() {
if (disguiseInUse) {
disguiseInUse = false;
if (taskId != -1) {
Bukkit.getScheduler().cancelTask(taskId);
taskId = -1;
if (task != null) {
task.cancel();
task = null;
}
HashMap<UUID, HashSet<TargetedDisguise>> disguises = DisguiseUtilities.getDisguises();
// If this disguise has a entity set
@ -657,7 +658,7 @@ public abstract class Disguise {
throw new RuntimeException("No entity is assigned to this disguise!");
}
disguiseInUse = true;
taskId = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, velocityRunnable, 1, 1);
task = Bukkit.getScheduler().runTaskTimer(plugin, velocityRunnable, 1, 1);
// Stick the disguise in the disguises bin
DisguiseUtilities.addDisguise(entity.getUniqueId(), (TargetedDisguise) this);
// Resend the disguised entity's packet

View File

@ -387,11 +387,11 @@ public class DisguiseUtilities {
}
// Add null so that if this is called again. I already know I'm doing something about it
gameProfiles.put(playerName, null);
Bukkit.getScheduler().scheduleAsyncDelayedTask(libsDisguises, new Runnable() {
Bukkit.getScheduler().runTaskAsynchronously(libsDisguises, new Runnable() {
public void run() {
try {
final WrappedGameProfile gameProfile = lookupGameProfile(playerName);
Bukkit.getScheduler().scheduleSyncDelayedTask(libsDisguises, new Runnable() {
Bukkit.getScheduler().runTask(libsDisguises, new Runnable() {
public void run() {
if (gameProfiles.containsKey(playerName) && gameProfiles.get(playerName) == null) {
gameProfiles.put(playerName, gameProfile);
@ -647,7 +647,7 @@ public class DisguiseUtilities {
// If it is, then this method will be run again in one tick. Which is when it should be constructed.
// Else its going to run in a infinite loop hue hue hue..
// At least until this disguise is discarded
Bukkit.getScheduler().scheduleSyncDelayedTask(libsDisguises, new Runnable() {
Bukkit.getScheduler().runTask(libsDisguises, new Runnable() {
public void run() {
if (DisguiseAPI.getDisguise(player, player) == disguise) {
sendSelfDisguise(player, disguise);

View File

@ -909,7 +909,7 @@ public class PacketsManager {
if (clickedItem != null && clickedItem.getType() != Material.AIR) {
// Rather than predict the clients actions
// Lets just update the entire inventory..
Bukkit.getScheduler().scheduleSyncDelayedTask(libsDisguises, new Runnable() {
Bukkit.getScheduler().runTask(libsDisguises, new Runnable() {
public void run() {
event.getPlayer().updateInventory();
}