diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index 992979b..664bfd1 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index 051a138..2d460e5 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper -version: 3.12.2 +version: 3.12.2a loadbefore: [aPlugin] commands: money: diff --git a/src/sig/plugin/TwosideKeeper/CustomDamage.java b/src/sig/plugin/TwosideKeeper/CustomDamage.java index bc50e1c..3ad6bdb 100644 --- a/src/sig/plugin/TwosideKeeper/CustomDamage.java +++ b/src/sig/plugin/TwosideKeeper/CustomDamage.java @@ -113,6 +113,8 @@ public class CustomDamage { public static final int IS_HEADSHOT = 2; //System Flag. Used for telling a player structure their last hit was a headshot. public static final int IS_PREEMPTIVE = 4; //System Flag. Used for telling a player structure their last hit was a preemptive strike. public static final int IS_THORNS = 8; //System Flag. Used for telling a player structure their last hit was with thorns. + + public static final double BOSS_DAMAGE_LIMIT = 0.1; static public boolean ApplyDamage(double damage, Entity damager, LivingEntity target, ItemStack weapon, String reason) { //TwosideKeeper.log("Weapon: "+weapon, 0); @@ -4193,7 +4195,24 @@ public class CustomDamage { if (damage<0) { damage=0; } - return Math.min(damage, TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER-1); + double dmgLimit = getDamageLimit(target); + if (dmgLimit<1 && damage>target.getMaxHealth()*dmgLimit) { + //double olddamage = damage; + damage = target.getMaxHealth()*dmgLimit; + //TwosideKeeper.log("Damage limit reached (Hit for "+olddamage+". Lowering to "+damage, 1); + } + return Math.min(damage, TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER-1); + } + + /** + * @return Returns the percentage of max health that a player can deal to a target. + */ + private static double getDamageLimit(LivingEntity target) { + double pct = 1.0; + if (GenericFunctions.isBossMonster(target)) { + pct = BOSS_DAMAGE_LIMIT; + } + return pct; } public static boolean isFlagSet(int flags, int check) { diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/CastBar.java b/src/sig/plugin/TwosideKeeper/HelperStructures/CastBar.java new file mode 100644 index 0000000..4eab78a --- /dev/null +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/CastBar.java @@ -0,0 +1,28 @@ +package sig.plugin.TwosideKeeper.HelperStructures; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import sig.plugin.TwosideKeeper.HelperStructures.Common.CastBarItem; + +public class CastBar { + List castbaritems = new ArrayList(); + + public CastBar(CastBarItem...items) { + castbaritems = Arrays.asList(items); + while (castbaritems.size()<9) { + castbaritems.add(new CastBarItem(Material.AIR)); + } + } + + public void run(Player p) { + aPlugin.API.setSlot(p, 9); + for (int i=0;i<9;i++) { + aPlugin.API.setItem(p, p.getOpenInventory(), i, castbaritems.get(i).getItemStack()); + } + } +} diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/CastBarItem.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/CastBarItem.java new file mode 100644 index 0000000..ae00db8 --- /dev/null +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/CastBarItem.java @@ -0,0 +1,34 @@ +package sig.plugin.TwosideKeeper.HelperStructures.Common; + +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; +import org.bukkit.material.MaterialData; + +import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils; + +public class CastBarItem { + ItemStack item; + + public CastBarItem(Material mat) { + this(mat,(short)0,1,null); + } + + public CastBarItem(Material mat, short data, String displayName) { + this(mat,data,1,displayName); + } + + public CastBarItem(Material mat, short data, int amt, String displayName) { + item = new ItemStack(mat,amt,data); + if (displayName!=null) { + ItemUtils.setDisplayName(item, displayName); + } + } + + public CastBarItem(MaterialData matdata, String displayName) { + item = new ItemStack(matdata.getItemType(),1,matdata.getData()); + } + + public ItemStack getItemStack() { + return item; + } +} diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java index 59af2d5..b94d77c 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java @@ -5,6 +5,7 @@ import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -2315,6 +2316,7 @@ public class GenericFunctions { ((Guardian)m).isElder()) || m.getType()==EntityType.ENDER_DRAGON || m.getType()==EntityType.WITHER || + MonsterController.getLivingEntityDifficulty(m).name().contains("MINIBOSS") || LivingEntityStructure.GetLivingEntityStructure(m).getLeader() || LivingEntityStructure.GetLivingEntityStructure(m).getElite()) { return true; @@ -5736,54 +5738,77 @@ public class GenericFunctions { aPlugin.API.setItem(p, p.getOpenInventory(), i, view.getItem(i)); } } - public static List getItemList(List items) { - List itemsList = new ArrayList(); - for (ItemStack i: items) { - boolean found=false; - for (ItemContainer ic : itemsList) { - if (ic.getItem().isSimilar(i)) { - ic.setAmount(ic.getAmount()+i.getAmount()); - found=true; - break; + public static HashMap> getItemList(HashMap> items) { + HashMap> itemsList = new HashMap>(); + for (String key : items.keySet()) { + for (ItemStack i: items.get(key)) { + boolean found=false; + if (itemsList.containsKey(key)) { + List list = itemsList.get(key); + for (ItemContainer ic : list) { + if (ic.getItem().isSimilar(i)) { + ic.setAmount(ic.getAmount()+i.getAmount()); + found=true; + break; + } + } + if (!found) { + list.add(new ItemContainer(i)); + } + } else { + List list = new ArrayList(); + list.add(new ItemContainer(i)); + itemsList.put(key,list); } } - if (!found) { - itemsList.add(new ItemContainer(i)); - } } return itemsList; } - public static String generateItemList(List items) { + public static String generateItemList(HashMap> items) { return generateItemList(items,null); } - public static String generateItemList(List items, String[] args) { + public static String generateItemList(HashMap> items, String[] args) { + return generateItemList(items,args,false); + } + + public static String generateItemList(HashMap> items, String[] args, boolean discordOutput) { List filters = new ArrayList(); + //TwosideKeeper.log(Arrays.toString(args), 1); if (args==null || args.length==0) { //No filters applied. } else { for (String str : args) { filters.add(str); } + //TwosideKeeper.log("Filters: "+filters, 1); } //Sort from highest to least. Then in alphabetical order. - List sortedlist = new ArrayList(); - for (int i=0;i1?ChatColor.YELLOW+" x"+currentItem.getAmount():""); - for (String s : filters) { - if (!displayName.toLowerCase().contains(s.toLowerCase())) { - //TwosideKeeper.log("Cannot find "+s+" in "+displayName, 1); - matchesAll=false; - break; + HashMap> sortedmap = new HashMap>(); + for (String key : items.keySet()) { + //TwosideKeeper.log("Items from "+key+": "+items.get(key).toString(), 1); + List itemList = items.get(key); + for (int i=0;i1?ChatColor.YELLOW+" x"+currentItem.getAmount():""); + for (String s : filters) { + if (!displayName.toLowerCase().contains(s.toLowerCase())) { + //TwosideKeeper.log("Cannot find "+s+" in "+displayName, 1); + matchesAll=false; + break; + } } - } - if (sortedlist.size()>0) { - //Compare through every item. if (matchesAll) { + List sortedlist; + if (sortedmap.containsKey(key)) { + sortedlist = sortedmap.get(key); + } else { + sortedlist = new ArrayList(); + sortedmap.put(key, sortedlist); + } for (int j=0;jcheckItem.getAmount()) { @@ -5802,19 +5827,31 @@ public class GenericFunctions { sortedlist.add(currentItem); } } - } else { - if (matchesAll) { - sortedlist.add(items.get(i)); - } } } - return generateItemsList(sortedlist); + return generateItemsList(sortedmap, discordOutput); } - private static String generateItemsList(List list) { + private static String generateItemsList(HashMap> map) { + return generateItemsList(map,false); + } + + private static String generateItemsList(HashMap> map, boolean discordOutput) { StringBuilder sb = new StringBuilder(""); - for (int i=0;i1?ChatColor.YELLOW+" x"+list.get(i).getAmount():"")+ChatColor.RESET+(i+1!=list.size()?", ":"")); + for (String key : map.keySet()) { + List list = map.get(key); + if (discordOutput) { + sb.append("Items in **"+key+"**:\n\n"); + } else { + sb.append("Items in "+ChatColor.BOLD+key+ChatColor.RESET+":\n\n"); + } + for (int i=0;i1?ChatColor.YELLOW+" x"+list.get(i).getAmount():"")+ChatColor.RESET+(i+1!=list.size()?", ":"")); + } + sb.append("\n ___________________ \n"); + } + if (sb.length()==0) { + sb.append("Could not find any items!"); } return sb.toString(); } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Pet.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Pet.java index 8ffd7e8..761d234 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Pet.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Pet.java @@ -64,7 +64,7 @@ public class Pet { //TwosideKeeper.log("My Target is now "+GenericFunctions.GetEntityDisplayName(myTarget), 1); } else if (myTarget!=null) { //This is a valid target. If we are too far away, move towards it. Perform an attack when close enough if possible. - if (ent.getLocation().distanceSquared(myTarget.getLocation())>2) { + if (ent.getLocation().distanceSquared(myTarget.getLocation())>4) { setTargetLocation(myTarget.getLocation()); setState(PetState.MOVING); } else { @@ -89,7 +89,7 @@ public class Pet { } else { stuckTimer=0; lastPos=null; - setState(PetState.PASSIVE); + //setState(PetState.PASSIVE); } } else { lastPos = loc.clone(); @@ -109,9 +109,11 @@ public class Pet { } if (targetLoc!=null && ent.getLocation().distanceSquared(targetLoc)<=2) { targetLoc=null; + stuckTimer=0; setState(PetState.PASSIVE); } if (targetLoc==null) { + stuckTimer=0; setState(PetState.PASSIVE); } }break; @@ -124,6 +126,7 @@ public class Pet { setState(PetState.PASSIVE); }break; } + //TwosideKeeper.log("Pet State: "+myState, 1); } private Location MoveTowardsPoint(Location targetLoc) { @@ -168,7 +171,7 @@ public class Pet { //Attempt to find a target. Try the owner's target first. PlayerStructure pd = PlayerStructure.GetPlayerStructure(owner); myTarget = pd.target; - if (myTarget==null) { + if (myTarget==null || !myTarget.isValid()) { //Try to find a nearby target. List ents = GenericFunctions.getNearbyMonsters(ent.getLocation(), 4); double closestrange = Integer.MAX_VALUE; @@ -189,7 +192,6 @@ public class Pet { myTarget=selectedent; } } - //TwosideKeeper.log("My Target is now "+GenericFunctions.GetEntityDisplayName(myTarget), 1); } } else if (!ent.hasAI() && !isFighting()) { diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/RecyclingCenterNode.java b/src/sig/plugin/TwosideKeeper/HelperStructures/RecyclingCenterNode.java index f87d22a..438a5ec 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/RecyclingCenterNode.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/RecyclingCenterNode.java @@ -6,23 +6,21 @@ public class RecyclingCenterNode { private Location loc; private boolean toolsAllowed=true; private boolean itemsAllowed=true; + private String recyclingCenterName="Recycling Center"; - public RecyclingCenterNode(Location loc) { - this.loc=loc.clone(); - this.toolsAllowed=true; - this.itemsAllowed=true; + public RecyclingCenterNode(Location loc, String name) { + this(loc,name,true); } - public RecyclingCenterNode(Location loc, boolean toolsAllowed) { - this.loc=loc.clone(); - this.toolsAllowed=toolsAllowed; - this.itemsAllowed=true; + public RecyclingCenterNode(Location loc, String name, boolean toolsAllowed) { + this(loc,name,toolsAllowed,true); } - public RecyclingCenterNode(Location loc, boolean toolsAllowed, boolean itemsAllowed) { + public RecyclingCenterNode(Location loc, String name, boolean toolsAllowed, boolean itemsAllowed) { this.loc=loc.clone(); this.toolsAllowed=toolsAllowed; this.itemsAllowed=itemsAllowed; + this.recyclingCenterName=name; } public boolean areToolsAllowed() { @@ -41,12 +39,20 @@ public class RecyclingCenterNode { public void setItemsAllowed(boolean itemsAllowed) { this.itemsAllowed = itemsAllowed; } + + public String getRecyclingCenterName() { + return recyclingCenterName; + } + + public void setRecyclingCenterName(String name) { + this.recyclingCenterName = name; + } public Location getRecyclingCenterLocation() { return loc; } public String toString() { - return "RecyclingCenterNode(x="+loc.getBlockX()+",y="+loc.getBlockY()+",z="+loc.getBlockZ()+",tools="+toolsAllowed+",itemsAllowed="+itemsAllowed+")"; + return "RecyclingCenterNode(Name="+recyclingCenterName+",x="+loc.getBlockX()+",y="+loc.getBlockY()+",z="+loc.getBlockZ()+",tools="+toolsAllowed+",itemsAllowed="+itemsAllowed+")"; } } diff --git a/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java b/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java index 1f41ab4..2bef1f5 100644 --- a/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java +++ b/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java @@ -420,7 +420,7 @@ public class LivingEntityStructure { private int getNewAggroBasedOnAggroMultipliers(LivingEntity target, int amt) { if (target instanceof Player) { Player p = (Player)target; - amt = amt * ItemSet.GetTotalBaseAmount(p, ItemSet.SONGSTEEL); + amt += amt * ItemSet.GetTotalBaseAmount(p, ItemSet.SONGSTEEL); if (ItemSet.hasFullSet(p, ItemSet.PRIDE)) { return amt * ItemSet.getHighestTierInSet(p, ItemSet.PRIDE); } diff --git a/src/sig/plugin/TwosideKeeper/PlayerStructure.java b/src/sig/plugin/TwosideKeeper/PlayerStructure.java index ea3b1ae..f77eaf7 100644 --- a/src/sig/plugin/TwosideKeeper/PlayerStructure.java +++ b/src/sig/plugin/TwosideKeeper/PlayerStructure.java @@ -317,6 +317,7 @@ public class PlayerStructure { public CustomModel myModel=null; public String lastplayerHitBy = ""; //The last player that hurt this player. + public String recyclingCenterNodeSelectionName = ""; //Needs the instance of the player object to get all other info. Only to be called at the beginning. @SuppressWarnings("deprecation") diff --git a/src/sig/plugin/TwosideKeeper/RecyclingCenter.java b/src/sig/plugin/TwosideKeeper/RecyclingCenter.java index 49bcd13..0dbc4b1 100644 --- a/src/sig/plugin/TwosideKeeper/RecyclingCenter.java +++ b/src/sig/plugin/TwosideKeeper/RecyclingCenter.java @@ -28,6 +28,7 @@ public class RecyclingCenter { List nodes; HashMap itemmap; int totalitems=0; + final static int CONFIGFILE_VERSION = 2; boolean choosing = false; @@ -36,8 +37,8 @@ public class RecyclingCenter { itemmap = new HashMap(); } - public void AddNode(World world, int locx,int locy,int locz,boolean toolsAllowed,boolean itemsAllowed) { - nodes.add(new RecyclingCenterNode(new Location(world,locx,locy,locz),toolsAllowed,itemsAllowed)); + public void AddNode(World world, int locx,int locy,int locz,String name,boolean toolsAllowed,boolean itemsAllowed) { + nodes.add(new RecyclingCenterNode(new Location(world,locx,locy,locz),name,toolsAllowed,itemsAllowed)); } /** @@ -74,14 +75,20 @@ public class RecyclingCenter { if (config.exists()) { TwosideKeeper.log("Config exists. Entering.",5); FileConfiguration workable = YamlConfiguration.loadConfiguration(config); + if (workable.getInt("version",0)>=2) { + int nodecount = workable.getInt("nodeCount",0); + for (int i=0;i=1) { //Default version is 0. So if we can't find the version key, then we know we have to set it up. int nodecount = workable.getInt("nodeCount",0); for (int i=0;i{ - List recyclingCenterItems = populateRecyclingCenterItems(); + HashMap> recyclingCenterItems = populateRecyclingCenterItems(); if (args.length==1) { //Get a master list of all Recycling Center items. aPlugin.API.discordSendRaw("```\n"+ GenericFunctions.generateItemList( GenericFunctions.getItemList(recyclingCenterItems) - )+"\n```" + ,null,true)+"\n```" ); } else { //Try to use the search phrase given. @@ -1445,7 +1446,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { aPlugin.API.discordSendRaw("```\n"+ GenericFunctions.generateItemList( GenericFunctions.getItemList(recyclingCenterItems) - ,args + ,args, true )+"\n```" ); } @@ -1749,7 +1750,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } else if (cmd.getName().equalsIgnoreCase("search")) { - List recyclingCenterItems = populateRecyclingCenterItems(); + HashMap> recyclingCenterItems = populateRecyclingCenterItems(); if (args.length==0) { //Get a master list of all Recycling Center items. sender.sendMessage( @@ -1764,7 +1765,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { ,args )); } - return false; + return true; } else if (cmd.getName().equalsIgnoreCase("dailyloot")) { @@ -1867,6 +1868,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { DecimalFormat df = new DecimalFormat("0.00"); if (cmd.getName().equalsIgnoreCase("fix")) { Player p = (Player)sender; + //aPlugin.API.setSlot(p, 10); + //Buff.addBuff(p, 500, 1, BuffTemplate.CONFUSION); if (Artifact.isMalleableBase(p.getEquipment().getItemInMainHand()) && MalleableBaseQuest.getTimeStarted(p.getEquipment().getItemInMainHand())<=213747510) { p.getEquipment().setItemInMainHand(MalleableBaseQuest.setTimeStarted(p.getEquipment().getItemInMainHand(), getServerTickTime())); @@ -2884,6 +2887,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { case "PET":{ PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); pd.myPet = new Pet(p, EntityType.OCELOT, "Test"); + pd.myPet.getEntity().setMaxHealth(200); + pd.myPet.getEntity().setHealth(200); }break; case "SCEPTER":{ ItemStack scepter = new ItemStack(Material.BONE); @@ -3154,7 +3159,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener { Player p = (Player)sender; TwosideRecyclingCenter.setChoosingRecyclingCenter(!TwosideRecyclingCenter.isChoosingRecyclingCenter()); if (TwosideRecyclingCenter.isChoosingRecyclingCenter()) { - p.sendMessage(ChatColor.GREEN+"Click on a Chest to set up a new Recycling Center Node."); + if (args.length>=1) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + pd.recyclingCenterNodeSelectionName = args[0]; + p.sendMessage(ChatColor.GREEN+"Click on a Chest to set up a new Recycling Center Node with name "+ChatColor.BLUE+pd.recyclingCenterNodeSelectionName+ChatColor.GREEN+". Or click on an existing chest to modify the Recycling Center name."); + } else { + p.sendMessage(ChatColor.GREEN+"Click on a Chest to set up a new Recycling Center Node. Or click on an existing chest to modify the Recycling Center name."); + } } else { p.sendMessage(ChatColor.RED+"Cancelled Recycling Center selection mode."); } @@ -3393,20 +3404,29 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } return false; } - private static List populateRecyclingCenterItems() { - List recyclingCenterItems = new ArrayList(); + private static HashMap> populateRecyclingCenterItems() { + HashMap> recyclingCenterItems = new HashMap>(); for (RecyclingCenterNode node : TwosideKeeper.TwosideRecyclingCenter.nodes) { - BlockState bs = node.getRecyclingCenterLocation().getBlock().getState(); - if (bs instanceof Chest) { - Chest c = (Chest)bs; - for (ItemStack it : c.getBlockInventory().getContents()) { - if (ItemUtils.isValidItem(it)) { - recyclingCenterItems.add(it); - } - } + if (recyclingCenterItems.containsKey(node.getRecyclingCenterName())) { + recyclingCenterItems.get(node.getRecyclingCenterName()).addAll(populateRecyclingCenterItems(node)); } else { - TwosideKeeper.log("WARNING! Cannot find chest at Node location "+node.toString()+"!", 1); + recyclingCenterItems.put(node.getRecyclingCenterName(), new ArrayList<>(populateRecyclingCenterItems(node))); + } + } + return recyclingCenterItems; + } + private static List populateRecyclingCenterItems(RecyclingCenterNode node) { + List recyclingCenterItems = new ArrayList(); + BlockState bs = node.getRecyclingCenterLocation().getBlock().getState(); + if (bs instanceof Chest) { + Chest c = (Chest)bs; + for (ItemStack it : c.getBlockInventory().getContents()) { + if (ItemUtils.isValidItem(it)) { + recyclingCenterItems.add(it); + } } + } else { + TwosideKeeper.log("WARNING! Cannot find chest at Node location "+node.toString()+"!", 1); } return recyclingCenterItems; } @@ -4756,11 +4776,27 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (ev.getClickedBlock()!=null && ev.getClickedBlock().getType()==Material.CHEST && TwosideRecyclingCenter.isChoosingRecyclingCenter() && ev.getPlayer().hasPermission("TwosideKeeper.recyclingcenter")) { - TwosideRecyclingCenter.setChoosingRecyclingCenter(false); - //Create a new Recycling Center. - TwosideRecyclingCenter.AddNode(ev.getClickedBlock().getWorld(), ev.getClickedBlock().getLocation().getBlockX(), ev.getClickedBlock().getLocation().getBlockY(), ev.getClickedBlock().getLocation().getBlockZ(), true, true); - TwosideRecyclingCenter.populateItemListFromNode(ev.getClickedBlock().getLocation()); - ev.getPlayer().sendMessage(ChatColor.DARK_BLUE+"New Recycling Center successfully created at "+ev.getClickedBlock().getLocation().toString()); + String newName = "Recycling Center"; + if (pd.recyclingCenterNodeSelectionName.length()>0) { + newName = pd.recyclingCenterNodeSelectionName; + //pd.recyclingCenterNodeSelectionName = ""; + } + if (RecyclingCenter.isRecyclingCenter(ev.getClickedBlock())) { + for (RecyclingCenterNode node : TwosideRecyclingCenter.nodes) { + if (node.getRecyclingCenterLocation().getBlock().equals(ev.getClickedBlock())) { + node.setRecyclingCenterName(newName); + break; + } + } + ev.getPlayer().sendMessage(ChatColor.GREEN+"Renamed Recycling Center to "+ChatColor.BLUE+newName+ChatColor.GREEN+"."); + } + else { + TwosideRecyclingCenter.setChoosingRecyclingCenter(false); + //Create a new Recycling Center. + TwosideRecyclingCenter.AddNode(ev.getClickedBlock().getWorld(), ev.getClickedBlock().getLocation().getBlockX(), ev.getClickedBlock().getLocation().getBlockY(), ev.getClickedBlock().getLocation().getBlockZ(), newName, true, true); + TwosideRecyclingCenter.populateItemListFromNode(ev.getClickedBlock().getLocation()); + ev.getPlayer().sendMessage(ChatColor.DARK_BLUE+"New Recycling Center successfully created at "+ev.getClickedBlock().getLocation().toString()); + } ev.setCancelled(true); return; } @@ -7011,6 +7047,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { },1); PreventConfusedPlayersFromAdjustingProperly(player); Christmas.RunPlayerItemHeldEvent(ev); + //TwosideKeeper.log("Item Change", 0); } private void PreventConfusedPlayersFromAdjustingProperly(Player p) { @@ -8554,6 +8591,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (les.aggro_table.size()>1) { finaltext = TextUtils.createAggroBar(les.getAggroPercentage(p)) +" "+ finaltext; } + //TwosideKeeper.log(les.displayAggroTable(),1); } pd.customtitle.modifySmallCenterTitle(finaltext, 100); } else { @@ -8564,6 +8602,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (les.aggro_table.size()>1) { finaltext = TextUtils.createAggroBar(les.getAggroPercentage(p)) + " "+ finaltext; } + //TwosideKeeper.log(les.displayAggroTable(),1); } pd.customtitle.modifySmallCenterTitle(finaltext, 100); //p.sendTitle(message1, finalMonsterName+" "+finalheartdisplay+" "+ChatColor.RESET+ChatColor.DARK_GRAY+"x"+(int)(target.getHealth()/20+1));