Added toReadable to disguisetype
This commit is contained in:
parent
0dff3706cd
commit
d4ae115d19
@ -29,7 +29,7 @@ public class DisguiseCommand extends BaseDisguiseCommand {
|
|||||||
try {
|
try {
|
||||||
Disguise disguise = parseDisguise(sender, args);
|
Disguise disguise = parseDisguise(sender, args);
|
||||||
DisguiseAPI.disguiseToAll((Player) sender, disguise);
|
DisguiseAPI.disguiseToAll((Player) sender, disguise);
|
||||||
sender.sendMessage(ChatColor.RED + "Now disguised as a " + toReadable(disguise.getType().name()));
|
sender.sendMessage(ChatColor.RED + "Now disguised as a " + disguise.getType().toReadable());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
if (ex.getMessage() != null) {
|
if (ex.getMessage() != null) {
|
||||||
sender.sendMessage(ex.getMessage());
|
sender.sendMessage(ex.getMessage());
|
||||||
@ -52,11 +52,4 @@ public class DisguiseCommand extends BaseDisguiseCommand {
|
|||||||
if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block"))
|
if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block"))
|
||||||
sender.sendMessage(ChatColor.DARK_GREEN + "/disguiseplayer <Dropped_Item/Falling_Block> <Id> <Durability>");
|
sender.sendMessage(ChatColor.DARK_GREEN + "/disguiseplayer <Dropped_Item/Falling_Block> <Id> <Durability>");
|
||||||
}
|
}
|
||||||
|
|
||||||
private String toReadable(String name) {
|
|
||||||
String[] split = name.split("_");
|
|
||||||
for (int i = 0; i < split.length; i++)
|
|
||||||
split[i] = split[i].substring(0, 1) + split[i].substring(1).toLowerCase();
|
|
||||||
return StringUtils.join(split, " ");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public class DisguiseEntityCommand extends BaseDisguiseCommand {
|
|||||||
Disguise disguise = parseDisguise(sender, args);
|
Disguise disguise = parseDisguise(sender, args);
|
||||||
listener.setSlap(sender.getName(), disguise);
|
listener.setSlap(sender.getName(), disguise);
|
||||||
sender.sendMessage(ChatColor.RED + "Right click a entity in the next 10 seconds to disguise it as a "
|
sender.sendMessage(ChatColor.RED + "Right click a entity in the next 10 seconds to disguise it as a "
|
||||||
+ toReadable(disguise.getType().name()) + "!");
|
+ disguise.getType().toReadable() + "!");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
if (ex.getMessage() != null) {
|
if (ex.getMessage() != null) {
|
||||||
sender.sendMessage(ex.getMessage());
|
sender.sendMessage(ex.getMessage());
|
||||||
@ -59,10 +59,4 @@ public class DisguiseEntityCommand extends BaseDisguiseCommand {
|
|||||||
sender.sendMessage(ChatColor.DARK_GREEN + "/disguiseentity <Dropped_Item/Falling_Block> <Id> <Durability>");
|
sender.sendMessage(ChatColor.DARK_GREEN + "/disguiseentity <Dropped_Item/Falling_Block> <Id> <Durability>");
|
||||||
}
|
}
|
||||||
|
|
||||||
private String toReadable(String name) {
|
|
||||||
String[] split = name.split("_");
|
|
||||||
for (int i = 0; i < split.length; i++)
|
|
||||||
split[i] = split[i].substring(0, 1) + split[i].substring(1).toLowerCase();
|
|
||||||
return StringUtils.join(split, " ");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ public class DisguisePlayerCommand extends BaseDisguiseCommand {
|
|||||||
Disguise disguise = parseDisguise(sender, newArgs);
|
Disguise disguise = parseDisguise(sender, newArgs);
|
||||||
DisguiseAPI.disguiseToAll(player, disguise);
|
DisguiseAPI.disguiseToAll(player, disguise);
|
||||||
sender.sendMessage(ChatColor.RED + "Successfully disguised " + player.getName() + " as a "
|
sender.sendMessage(ChatColor.RED + "Successfully disguised " + player.getName() + " as a "
|
||||||
+ toReadable(disguise.getType().name()) + "!");
|
+ disguise.getType().toReadable() + "!");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
if (ex.getMessage() != null) {
|
if (ex.getMessage() != null) {
|
||||||
sender.sendMessage(ex.getMessage());
|
sender.sendMessage(ex.getMessage());
|
||||||
@ -69,11 +69,4 @@ public class DisguisePlayerCommand extends BaseDisguiseCommand {
|
|||||||
sender.sendMessage(ChatColor.DARK_GREEN
|
sender.sendMessage(ChatColor.DARK_GREEN
|
||||||
+ "/disguiseplayer <PlayerName> <Dropped_Item/Falling_Block> <Id> <Durability>");
|
+ "/disguiseplayer <PlayerName> <Dropped_Item/Falling_Block> <Id> <Durability>");
|
||||||
}
|
}
|
||||||
|
|
||||||
private String toReadable(String name) {
|
|
||||||
String[] split = name.split("_");
|
|
||||||
for (int i = 0; i < split.length; i++)
|
|
||||||
split[i] = split[i].substring(0, 1) + split[i].substring(1).toLowerCase();
|
|
||||||
return StringUtils.join(split, " ");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ public class DisguiseRadiusCommand extends BaseDisguiseCommand {
|
|||||||
for (Entity entity : ((Player) sender).getNearbyEntities(radius, radius, radius)) {
|
for (Entity entity : ((Player) sender).getNearbyEntities(radius, radius, radius)) {
|
||||||
if (entity == sender)
|
if (entity == sender)
|
||||||
continue;
|
continue;
|
||||||
DisguiseAPI.disguiseToAll(entity, disguise.clone());
|
DisguiseAPI.disguiseToAll(entity, disguise);
|
||||||
disguisedEntitys++;
|
disguisedEntitys++;
|
||||||
}
|
}
|
||||||
sender.sendMessage(ChatColor.RED + "Successfully disguised " + disguisedEntitys + " entities!");
|
sender.sendMessage(ChatColor.RED + "Successfully disguised " + disguisedEntitys + " entities!");
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.libraryaddict.disguise.disguisetypes;
|
package me.libraryaddict.disguise.disguisetypes;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
|
||||||
public enum DisguiseType {
|
public enum DisguiseType {
|
||||||
@ -131,6 +132,13 @@ public enum DisguiseType {
|
|||||||
return DisguiseType.valueOf(entityType.name());
|
return DisguiseType.valueOf(entityType.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toReadable() {
|
||||||
|
String[] split = name().split("_");
|
||||||
|
for (int i = 0; i < split.length; i++)
|
||||||
|
split[i] = split[i].substring(0, 1) + split[i].substring(1).toLowerCase();
|
||||||
|
return StringUtils.join(split, " ");
|
||||||
|
}
|
||||||
|
|
||||||
private int defaultData;
|
private int defaultData;
|
||||||
private int defaultId;
|
private int defaultId;
|
||||||
private int entityId;
|
private int entityId;
|
||||||
|
Loading…
Reference in New Issue
Block a user