Added options to choose how long a disguise entity and disguise clone command is valid for
This commit is contained in:
@@ -8,6 +8,8 @@ public class DisguiseConfig {
|
||||
private static boolean blowDisguisesOnAttack;
|
||||
private static boolean collectEnabled;
|
||||
private static String disguiseBlownMessage;
|
||||
private static int disguiseCloneExpire;
|
||||
private static int disguiseEntityExpire;
|
||||
private static boolean enquipmentEnabled;
|
||||
private static boolean entityAnimationsAdded;
|
||||
private static boolean entityStatusEnabled;
|
||||
@@ -34,6 +36,14 @@ public class DisguiseConfig {
|
||||
return disguiseBlownMessage;
|
||||
}
|
||||
|
||||
public static int getDisguiseCloneExpire() {
|
||||
return disguiseCloneExpire;
|
||||
}
|
||||
|
||||
public static int getDisguiseEntityExpire() {
|
||||
return disguiseEntityExpire;
|
||||
}
|
||||
|
||||
public static boolean isAnimationPacketsEnabled() {
|
||||
return animationEnabled;
|
||||
}
|
||||
@@ -190,6 +200,14 @@ public class DisguiseConfig {
|
||||
blowDisguisesOnAttack = blowDisguise;
|
||||
}
|
||||
|
||||
public static void setDisguiseCloneExpire(int newExpires) {
|
||||
disguiseCloneExpire = newExpires;
|
||||
}
|
||||
|
||||
public static void setDisguiseEntityExpire(int newExpires) {
|
||||
disguiseEntityExpire = newExpires;
|
||||
}
|
||||
|
||||
public static void setEnquipmentPacketsEnabled(boolean enabled) {
|
||||
if (enabled != isEnquipmentPacketsEnabled()) {
|
||||
enquipmentEnabled = enabled;
|
||||
|
@@ -254,7 +254,7 @@ public class DisguiseListener implements Listener {
|
||||
disguiseRunnable.remove(player);
|
||||
}
|
||||
};
|
||||
runnable.runTaskLater(plugin, 20 * 10);
|
||||
runnable.runTaskLater(plugin, 20 * DisguiseConfig.getDisguiseCloneExpire());
|
||||
disguiseRunnable.put(player, runnable);
|
||||
disguiseClone.put(player, options);
|
||||
}
|
||||
@@ -271,7 +271,7 @@ public class DisguiseListener implements Listener {
|
||||
disguiseRunnable.remove(player);
|
||||
}
|
||||
};
|
||||
runnable.runTaskLater(plugin, 20 * 10);
|
||||
runnable.runTaskLater(plugin, 20 * DisguiseConfig.getDisguiseEntityExpire());
|
||||
disguiseRunnable.put(player, runnable);
|
||||
disguiseEntity.put(player, disguise);
|
||||
}
|
||||
|
@@ -117,6 +117,8 @@ public class LibsDisguises extends JavaPlugin {
|
||||
DisguiseConfig.setCollectPacketsEnabled(getConfig().getBoolean("PacketsEnabled.Collect"));
|
||||
DisguiseConfig.setMetadataPacketsEnabled(getConfig().getBoolean("PacketsEnabled.Metadata"));
|
||||
DisguiseConfig.setMaxHealthDeterminedByDisguisedEntity(getConfig().getBoolean("MaxHealthDeterminedByEntity"));
|
||||
DisguiseConfig.setDisguiseEntityExpire(getConfig().getInt("DisguiseEntityExpire"));
|
||||
DisguiseConfig.setDisguiseCloneExpire(getConfig().getInt("DisguiseCloneExpire"));
|
||||
try {
|
||||
// Here I use reflection to set the plugin for Disguise..
|
||||
// Kind of stupid but I don't want open API calls for a commonly used object.
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package me.libraryaddict.disguise.commands;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseConfig;
|
||||
import me.libraryaddict.disguise.DisguiseListener;
|
||||
import me.libraryaddict.disguise.utilities.BaseDisguiseCommand;
|
||||
|
||||
@@ -43,7 +44,8 @@ public class DisguiseCloneCommand extends BaseDisguiseCommand {
|
||||
}
|
||||
}
|
||||
listener.setDisguiseClone(sender.getName(), new Boolean[] { doEnquipment, doSneak, doSprint });
|
||||
sender.sendMessage(ChatColor.RED + "Right click a entity in the next 10 seconds to disguise as it!");
|
||||
sender.sendMessage(ChatColor.RED + "Right click a entity in the next " + DisguiseConfig.getDisguiseCloneExpire()
|
||||
+ " seconds to disguise as it!");
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "There was once a curious little boy,"
|
||||
+ " he liked to try out these strange sounding commands."
|
||||
|
@@ -1,6 +1,8 @@
|
||||
package me.libraryaddict.disguise.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseConfig;
|
||||
import me.libraryaddict.disguise.DisguiseListener;
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.utilities.BaseDisguiseCommand;
|
||||
@@ -36,8 +38,8 @@ public class DisguiseEntityCommand extends BaseDisguiseCommand {
|
||||
return true;
|
||||
}
|
||||
listener.setDisguiseEntity(sender.getName(), disguise);
|
||||
sender.sendMessage(ChatColor.RED + "Right click a entity in the next 10 seconds to disguise it as a "
|
||||
+ disguise.getType().toReadable() + "!");
|
||||
sender.sendMessage(ChatColor.RED + "Right click a entity in the next " + DisguiseConfig.getDisguiseEntityExpire()
|
||||
+ " seconds to disguise it as a " + disguise.getType().toReadable() + "!");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user