Cleaned up classes

This commit is contained in:
Andrew 2013-11-06 05:53:53 +13:00
parent 48029b8849
commit e8d821619c
6 changed files with 14 additions and 47 deletions

View File

@ -1,20 +1,12 @@
package me.libraryaddict.disguise.commands;
import java.util.ArrayList;
import java.util.Collections;
import me.libraryaddict.disguise.BaseDisguiseCommand;
import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
import me.libraryaddict.disguise.disguisetypes.MobDisguise;
import me.libraryaddict.disguise.disguisetypes.PlayerDisguise;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -1,20 +1,12 @@
package me.libraryaddict.disguise.commands;
import java.util.ArrayList;
import java.util.Collections;
import me.libraryaddict.disguise.BaseDisguiseCommand;
import me.libraryaddict.disguise.DisguiseListener;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
import me.libraryaddict.disguise.disguisetypes.MobDisguise;
import me.libraryaddict.disguise.disguisetypes.PlayerDisguise;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
public class DisguiseEntityCommand extends BaseDisguiseCommand {

View File

@ -5,19 +5,11 @@ import java.util.ArrayList;
import java.util.Collections;
import me.libraryaddict.disguise.BaseDisguiseCommand;
import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
import me.libraryaddict.disguise.disguisetypes.MobDisguise;
import me.libraryaddict.disguise.disguisetypes.PlayerDisguise;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class DisguiseHelpCommand extends BaseDisguiseCommand {

View File

@ -1,21 +1,12 @@
package me.libraryaddict.disguise.commands;
import java.util.ArrayList;
import java.util.Collections;
import me.libraryaddict.disguise.BaseDisguiseCommand;
import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
import me.libraryaddict.disguise.disguisetypes.MobDisguise;
import me.libraryaddict.disguise.disguisetypes.PlayerDisguise;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;

View File

@ -132,19 +132,12 @@ public enum DisguiseType {
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 defaultId;
private int entityId;
private EntityType entityType;
private Class watcherClass;
private DisguiseType(EntityType newType, int... obj) {
entityType = newType;
for (int i = 0; i < obj.length; i++) {
@ -200,4 +193,11 @@ public enum DisguiseType {
public void setWatcherClass(Class c) {
watcherClass = c;
}
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, " ");
}
}

View File

@ -49,12 +49,12 @@ public class FlagWatcher {
classTypes.put(ItemStack.class, 5);
classTypes.put(ChunkCoordinates.class, 6);
}
private Disguise disguise;
private HashMap<Integer, Object> entityValues = new HashMap<Integer, Object>();
/**
* This is the entity values I need to add else it could crash them..
*/
private HashMap<Integer, Object> backupEntityValues = new HashMap<Integer, Object>();
private Disguise disguise;
private HashMap<Integer, Object> entityValues = new HashMap<Integer, Object>();
private boolean hasDied;
private org.bukkit.inventory.ItemStack[] items = new org.bukkit.inventory.ItemStack[5];
@ -226,6 +226,10 @@ public class FlagWatcher {
setItemStack(i, itemstack[i]);
}
protected void setBackupValue(int no, Object value) {
backupEntityValues.put(no, value);
}
public void setBurning(boolean setBurning) {
setFlag(0, 0, setBurning);
sendData(0);
@ -320,8 +324,4 @@ public class FlagWatcher {
entityValues.put(no, value);
}
protected void setBackupValue(int no, Object value) {
backupEntityValues.put(no, value);
}
}