commit
57be672b1b
@ -45,7 +45,7 @@ public class DisguiseListener implements Listener {
|
|||||||
updateNotifyPermission = plugin.getConfig().getString("Permission");
|
updateNotifyPermission = plugin.getConfig().getString("Permission");
|
||||||
if (plugin.getConfig().getBoolean("NotifyUpdate")) {
|
if (plugin.getConfig().getBoolean("NotifyUpdate")) {
|
||||||
currentVersion = plugin.getDescription().getVersion();
|
currentVersion = plugin.getDescription().getVersion();
|
||||||
Bukkit.getScheduler().scheduleAsyncRepeatingTask(plugin, new Runnable() {
|
Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
UpdateChecker updateChecker = new UpdateChecker();
|
UpdateChecker updateChecker = new UpdateChecker();
|
||||||
@ -53,7 +53,7 @@ public class DisguiseListener implements Listener {
|
|||||||
latestVersion = updateChecker.getLatestVersion();
|
latestVersion = updateChecker.getLatestVersion();
|
||||||
if (latestVersion != null) {
|
if (latestVersion != null) {
|
||||||
latestVersion = "v" + latestVersion;
|
latestVersion = "v" + latestVersion;
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
if (p.hasPermission(updateNotifyPermission))
|
if (p.hasPermission(updateNotifyPermission))
|
||||||
@ -239,7 +239,7 @@ public class DisguiseListener implements Listener {
|
|||||||
if (event.getExited() instanceof Player) {
|
if (event.getExited() instanceof Player) {
|
||||||
final Disguise disguise = DisguiseAPI.getDisguise((Player) event.getExited(), event.getExited());
|
final Disguise disguise = DisguiseAPI.getDisguise((Player) event.getExited(), event.getExited());
|
||||||
if (disguise != null) {
|
if (disguise != null) {
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
DisguiseUtilities.setupFakeDisguise(disguise);
|
DisguiseUtilities.setupFakeDisguise(disguise);
|
||||||
((Player) disguise.getEntity()).updateInventory();
|
((Player) disguise.getEntity()).updateInventory();
|
||||||
|
@ -28,12 +28,12 @@ public class DisguiseCloneCommand extends BaseDisguiseCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (sender.hasPermission("libsdisguises.disguise.disguiseclone")) {
|
if (sender.hasPermission("libsdisguises.disguise.disguiseclone")) {
|
||||||
boolean doEnquipment = true;
|
boolean doEquipment = true;
|
||||||
boolean doSneak = false;
|
boolean doSneak = false;
|
||||||
boolean doSprint = false;
|
boolean doSprint = false;
|
||||||
for (String option : args) {
|
for (String option : args) {
|
||||||
if (StringUtils.startsWithIgnoreCase(option, "ignoreEnquip")) {
|
if (StringUtils.startsWithIgnoreCase(option, "ignoreEquip") || StringUtils.startsWithIgnoreCase(option, "ignoreEnquip")) {
|
||||||
doEnquipment = false;
|
doEquipment = false;
|
||||||
} else if (option.equalsIgnoreCase("doSneakSprint")) {
|
} else if (option.equalsIgnoreCase("doSneakSprint")) {
|
||||||
doSneak = true;
|
doSneak = true;
|
||||||
doSprint = true;
|
doSprint = true;
|
||||||
@ -43,11 +43,11 @@ public class DisguiseCloneCommand extends BaseDisguiseCommand {
|
|||||||
doSprint = true;
|
doSprint = true;
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(ChatColor.DARK_RED + "Unknown option '" + option
|
sender.sendMessage(ChatColor.DARK_RED + "Unknown option '" + option
|
||||||
+ "' - Valid options are 'IgnoreEnquipment' 'DoSneakSprint' 'DoSneak' 'DoSprint'");
|
+ "' - Valid options are 'IgnoreEquipment' 'DoSneakSprint' 'DoSneak' 'DoSprint'");
|
||||||
return true;
|
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()
|
sender.sendMessage(ChatColor.RED + "Right click a entity in the next " + DisguiseConfig.getDisguiseCloneExpire()
|
||||||
+ " seconds to grab the disguise reference!");
|
+ " seconds to grab the disguise reference!");
|
||||||
} else {
|
} else {
|
||||||
@ -62,8 +62,8 @@ public class DisguiseCloneCommand extends BaseDisguiseCommand {
|
|||||||
protected void sendCommandUsage(CommandSender sender, HashMap<DisguiseType, HashMap<ArrayList<String>, Boolean>> map) {
|
protected void sendCommandUsage(CommandSender sender, HashMap<DisguiseType, HashMap<ArrayList<String>, Boolean>> map) {
|
||||||
sender.sendMessage(ChatColor.DARK_GREEN
|
sender.sendMessage(ChatColor.DARK_GREEN
|
||||||
+ "Right click a entity to get a disguise reference you can pass to other disguise commands!");
|
+ "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 + "Security note: Any references you create will be available to all players able to use disguise references.");
|
||||||
sender.sendMessage(ChatColor.DARK_GREEN + "/disguiseclone IgnoreEnquipment" + ChatColor.DARK_GREEN + "("
|
sender.sendMessage(ChatColor.DARK_GREEN + "/disguiseclone IgnoreEquipment" + ChatColor.DARK_GREEN + "("
|
||||||
+ ChatColor.GREEN + "Optional" + ChatColor.DARK_GREEN + ")");
|
+ ChatColor.GREEN + "Optional" + ChatColor.DARK_GREEN + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ public class LibsDisguisesCommand implements CommandExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
|
// TODO is public version disclosure a problem?
|
||||||
sender.sendMessage(ChatColor.DARK_GREEN
|
sender.sendMessage(ChatColor.DARK_GREEN
|
||||||
+ "This server is running "
|
+ "This server is running "
|
||||||
+ "Lib's Disguises "
|
+ "Lib's Disguises "
|
||||||
|
@ -25,6 +25,7 @@ import org.bukkit.entity.Horse.Variant;
|
|||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.comphenix.protocol.PacketType;
|
import com.comphenix.protocol.PacketType;
|
||||||
@ -45,7 +46,7 @@ public abstract class Disguise {
|
|||||||
private boolean keepDisguisePlayerLogout = DisguiseConfig.isKeepDisguiseOnPlayerLogout();
|
private boolean keepDisguisePlayerLogout = DisguiseConfig.isKeepDisguiseOnPlayerLogout();
|
||||||
private boolean modifyBoundingBox = DisguiseConfig.isModifyBoundingBox();
|
private boolean modifyBoundingBox = DisguiseConfig.isModifyBoundingBox();
|
||||||
private boolean replaceSounds = DisguiseConfig.isSoundEnabled();
|
private boolean replaceSounds = DisguiseConfig.isSoundEnabled();
|
||||||
private int taskId = -1;
|
private BukkitTask task = null;
|
||||||
private Runnable velocityRunnable;
|
private Runnable velocityRunnable;
|
||||||
private boolean velocitySent = DisguiseConfig.isVelocitySent();
|
private boolean velocitySent = DisguiseConfig.isVelocitySent();
|
||||||
private boolean viewSelfDisguise = DisguiseConfig.isViewDisguises();
|
private boolean viewSelfDisguise = DisguiseConfig.isViewDisguises();
|
||||||
@ -188,8 +189,8 @@ public abstract class Disguise {
|
|||||||
} else {
|
} else {
|
||||||
entity = null;
|
entity = null;
|
||||||
watcher = getWatcher().clone(disguise);
|
watcher = getWatcher().clone(disguise);
|
||||||
Bukkit.getScheduler().cancelTask(taskId);
|
task.cancel();
|
||||||
taskId = -1;
|
task = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -404,9 +405,9 @@ public abstract class Disguise {
|
|||||||
public void removeDisguise() {
|
public void removeDisguise() {
|
||||||
if (disguiseInUse) {
|
if (disguiseInUse) {
|
||||||
disguiseInUse = false;
|
disguiseInUse = false;
|
||||||
if (taskId != -1) {
|
if (task != null) {
|
||||||
Bukkit.getScheduler().cancelTask(taskId);
|
task.cancel();
|
||||||
taskId = -1;
|
task = null;
|
||||||
}
|
}
|
||||||
HashMap<UUID, HashSet<TargetedDisguise>> disguises = DisguiseUtilities.getDisguises();
|
HashMap<UUID, HashSet<TargetedDisguise>> disguises = DisguiseUtilities.getDisguises();
|
||||||
// If this disguise has a entity set
|
// 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!");
|
throw new RuntimeException("No entity is assigned to this disguise!");
|
||||||
}
|
}
|
||||||
disguiseInUse = true;
|
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
|
// Stick the disguise in the disguises bin
|
||||||
DisguiseUtilities.addDisguise(entity.getUniqueId(), (TargetedDisguise) this);
|
DisguiseUtilities.addDisguise(entity.getUniqueId(), (TargetedDisguise) this);
|
||||||
// Resend the disguised entity's packet
|
// Resend the disguised entity's packet
|
||||||
|
@ -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
|
// Add null so that if this is called again. I already know I'm doing something about it
|
||||||
gameProfiles.put(playerName, null);
|
gameProfiles.put(playerName, null);
|
||||||
Bukkit.getScheduler().scheduleAsyncDelayedTask(libsDisguises, new Runnable() {
|
Bukkit.getScheduler().runTaskAsynchronously(libsDisguises, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
final WrappedGameProfile gameProfile = lookupGameProfile(playerName);
|
final WrappedGameProfile gameProfile = lookupGameProfile(playerName);
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(libsDisguises, new Runnable() {
|
Bukkit.getScheduler().runTask(libsDisguises, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (gameProfiles.containsKey(playerName) && gameProfiles.get(playerName) == null) {
|
if (gameProfiles.containsKey(playerName) && gameProfiles.get(playerName) == null) {
|
||||||
gameProfiles.put(playerName, gameProfile);
|
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.
|
// 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..
|
// Else its going to run in a infinite loop hue hue hue..
|
||||||
// At least until this disguise is discarded
|
// At least until this disguise is discarded
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(libsDisguises, new Runnable() {
|
Bukkit.getScheduler().runTask(libsDisguises, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (DisguiseAPI.getDisguise(player, player) == disguise) {
|
if (DisguiseAPI.getDisguise(player, player) == disguise) {
|
||||||
sendSelfDisguise(player, disguise);
|
sendSelfDisguise(player, disguise);
|
||||||
|
@ -909,7 +909,7 @@ public class PacketsManager {
|
|||||||
if (clickedItem != null && clickedItem.getType() != Material.AIR) {
|
if (clickedItem != null && clickedItem.getType() != Material.AIR) {
|
||||||
// Rather than predict the clients actions
|
// Rather than predict the clients actions
|
||||||
// Lets just update the entire inventory..
|
// Lets just update the entire inventory..
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(libsDisguises, new Runnable() {
|
Bukkit.getScheduler().runTask(libsDisguises, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
event.getPlayer().updateInventory();
|
event.getPlayer().updateInventory();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user