Recycling Center search improved with Recycling Centers getting names.

Damage limits added for all boss monsters.
master
sigonasr2 8 years ago
parent 1a285cbf7d
commit fb8d30b9c5
  1. BIN
      TwosideKeeper.jar
  2. 2
      src/plugin.yml
  3. 19
      src/sig/plugin/TwosideKeeper/CustomDamage.java
  4. 28
      src/sig/plugin/TwosideKeeper/HelperStructures/CastBar.java
  5. 34
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/CastBarItem.java
  6. 71
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
  7. 10
      src/sig/plugin/TwosideKeeper/HelperStructures/Pet.java
  8. 26
      src/sig/plugin/TwosideKeeper/HelperStructures/RecyclingCenterNode.java
  9. 2
      src/sig/plugin/TwosideKeeper/LivingEntityStructure.java
  10. 1
      src/sig/plugin/TwosideKeeper/PlayerStructure.java
  11. 27
      src/sig/plugin/TwosideKeeper/RecyclingCenter.java
  12. 59
      src/sig/plugin/TwosideKeeper/TwosideKeeper.java

Binary file not shown.

@ -1,6 +1,6 @@
name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.12.2
version: 3.12.2a
loadbefore: [aPlugin]
commands:
money:

@ -114,6 +114,8 @@ public class CustomDamage {
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);
return ApplyDamage(damage,damager,target,weapon,reason,NONE);
@ -4193,9 +4195,26 @@ public class CustomDamage {
if (damage<0) {
damage=0;
}
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) {
return (flags&check)>0;
}

@ -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<CastBarItem> castbaritems = new ArrayList<CastBarItem>();
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());
}
}
}

@ -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;
}
}

@ -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,11 +5738,14 @@ public class GenericFunctions {
aPlugin.API.setItem(p, p.getOpenInventory(), i, view.getItem(i));
}
}
public static List<ItemContainer> getItemList(List<ItemStack> items) {
List<ItemContainer> itemsList = new ArrayList<ItemContainer>();
for (ItemStack i: items) {
public static HashMap<String,List<ItemContainer>> getItemList(HashMap<String,List<ItemStack>> items) {
HashMap<String,List<ItemContainer>> itemsList = new HashMap<String,List<ItemContainer>>();
for (String key : items.keySet()) {
for (ItemStack i: items.get(key)) {
boolean found=false;
for (ItemContainer ic : itemsList) {
if (itemsList.containsKey(key)) {
List<ItemContainer> list = itemsList.get(key);
for (ItemContainer ic : list) {
if (ic.getItem().isSimilar(i)) {
ic.setAmount(ic.getAmount()+i.getAmount());
found=true;
@ -5748,30 +5753,45 @@ public class GenericFunctions {
}
}
if (!found) {
itemsList.add(new ItemContainer(i));
list.add(new ItemContainer(i));
}
} else {
List<ItemContainer> list = new ArrayList<ItemContainer>();
list.add(new ItemContainer(i));
itemsList.put(key,list);
}
}
}
return itemsList;
}
public static String generateItemList(List<ItemContainer> items) {
public static String generateItemList(HashMap<String,List<ItemContainer>> items) {
return generateItemList(items,null);
}
public static String generateItemList(List<ItemContainer> items, String[] args) {
public static String generateItemList(HashMap<String,List<ItemContainer>> items, String[] args) {
return generateItemList(items,args,false);
}
public static String generateItemList(HashMap<String,List<ItemContainer>> items, String[] args, boolean discordOutput) {
List<String> filters = new ArrayList<String>();
//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<ItemContainer> sortedlist = new ArrayList<ItemContainer>();
for (int i=0;i<items.size();i++) {
HashMap<String,List<ItemContainer>> sortedmap = new HashMap<String,List<ItemContainer>>();
for (String key : items.keySet()) {
//TwosideKeeper.log("Items from "+key+": "+items.get(key).toString(), 1);
List<ItemContainer> itemList = items.get(key);
for (int i=0;i<itemList.size();i++) {
//Try to insert it into the list.
boolean found=false;
ItemContainer currentItem = items.get(i);
ItemContainer currentItem = itemList.get(i);
boolean matchesAll=true;
String displayName = GenericFunctions.UserFriendlyMaterialName(currentItem.getItem())+(TwosideKeeperAPI.isSetItem(currentItem.getItem())?" (T"+TwosideKeeperAPI.getItemTier(currentItem.getItem())+")":"")+(currentItem.getAmount()>1?ChatColor.YELLOW+" x"+currentItem.getAmount():"");
for (String s : filters) {
@ -5781,9 +5801,14 @@ public class GenericFunctions {
break;
}
}
if (sortedlist.size()>0) {
//Compare through every item.
if (matchesAll) {
List<ItemContainer> sortedlist;
if (sortedmap.containsKey(key)) {
sortedlist = sortedmap.get(key);
} else {
sortedlist = new ArrayList<ItemContainer>();
sortedmap.put(key, sortedlist);
}
for (int j=0;j<sortedlist.size();j++) {
ItemContainer checkItem = sortedlist.get(j);
if (currentItem.getAmount()>checkItem.getAmount()) {
@ -5802,20 +5827,32 @@ public class GenericFunctions {
sortedlist.add(currentItem);
}
}
} else {
if (matchesAll) {
sortedlist.add(items.get(i));
}
}
return generateItemsList(sortedmap, discordOutput);
}
return generateItemsList(sortedlist);
private static String generateItemsList(HashMap<String,List<ItemContainer>> map) {
return generateItemsList(map,false);
}
private static String generateItemsList(List<ItemContainer> list) {
private static String generateItemsList(HashMap<String,List<ItemContainer>> map, boolean discordOutput) {
StringBuilder sb = new StringBuilder("");
for (String key : map.keySet()) {
List<ItemContainer> 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;i<list.size();i++) {
sb.append(ChatColor.GRAY+GenericFunctions.UserFriendlyMaterialName(list.get(i).getItem())+(TwosideKeeperAPI.isSetItem(list.get(i).getItem())?" (T"+TwosideKeeperAPI.getItemTier(list.get(i).getItem())+")":"")+(list.get(i).getAmount()>1?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();
}
}

@ -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<LivingEntity> 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()) {

@ -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() {
@ -42,11 +40,19 @@ public class RecyclingCenterNode {
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+")";
}
}

@ -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);
}

@ -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")

@ -28,6 +28,7 @@ public class RecyclingCenter {
List<RecyclingCenterNode> nodes;
HashMap<Material,Integer> itemmap;
int totalitems=0;
final static int CONFIGFILE_VERSION = 2;
boolean choosing = false;
@ -36,8 +37,8 @@ public class RecyclingCenter {
itemmap = new HashMap<Material,Integer>();
}
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<nodecount;i++) {
this.AddNode(Bukkit.getWorld(workable.getString("world"+i)), workable.getInt("blockx"+i), workable.getInt("blocky"+i), workable.getInt("blockz"+i), workable.getString("name"+i), workable.getBoolean("toolsAllowed"+i,true), workable.getBoolean("itemsAllowed"+i,true));
}
} else
if (workable.getInt("version",0)>=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<nodecount;i++) {
this.AddNode(Bukkit.getWorld(workable.getString("world"+i)), workable.getInt("blockx"+i), workable.getInt("blocky"+i), workable.getInt("blockz"+i), workable.getBoolean("toolsAllowed"+i,true), workable.getBoolean("itemsAllowed"+i,true));
this.AddNode(Bukkit.getWorld(workable.getString("world"+i)), workable.getInt("blockx"+i), workable.getInt("blocky"+i), workable.getInt("blockz"+i), "Recycling Center", workable.getBoolean("toolsAllowed"+i,true), workable.getBoolean("itemsAllowed"+i,true));
}
} else {
for (int i=0;i<workable.getKeys(false).size()/4;i++) {
this.AddNode(Bukkit.getWorld(workable.getString("world"+i)), workable.getInt("blockx"+i), workable.getInt("blocky"+i), workable.getInt("blockz"+i),true,true);
this.AddNode(Bukkit.getWorld(workable.getString("world"+i)), workable.getInt("blockx"+i), workable.getInt("blocky"+i), workable.getInt("blockz"+i), "Recycling Center", true,true);
}
}
}
@ -100,7 +107,7 @@ public class RecyclingCenter {
config = new File(TwosideKeeper.filesave,"recyclingcenters.data");
FileConfiguration workable = YamlConfiguration.loadConfiguration(config);
workable.set("version", 1);
workable.set("version", CONFIGFILE_VERSION);
workable.set("nodeCount", nodes.size());
//workable.set("recycling_center.count", nodes.size());
@ -110,6 +117,7 @@ public class RecyclingCenter {
workable.set("blockx"+i, nodes.get(i).getRecyclingCenterLocation().getBlockX());
workable.set("blocky"+i, nodes.get(i).getRecyclingCenterLocation().getBlockY());
workable.set("blockz"+i, nodes.get(i).getRecyclingCenterLocation().getBlockZ());
workable.set("name"+i, nodes.get(i).getRecyclingCenterName());
workable.set("toolsAllowed"+i, nodes.get(i).areToolsAllowed());
workable.set("itemsAllowed"+i, nodes.get(i).areItemsAllowed());
}
@ -174,7 +182,14 @@ public class RecyclingCenter {
}
public static boolean isRecyclingCenter(Block b) {
return TwosideKeeper.TwosideRecyclingCenter.nodes.contains(new Location(b.getWorld(),b.getLocation().getBlockX(),b.getLocation().getBlockY(),b.getLocation().getBlockZ()));
for (RecyclingCenterNode node : TwosideKeeper.TwosideRecyclingCenter.nodes) {
Block b2 = node.getRecyclingCenterLocation().getBlock();
if (b2.equals(b)) {
return true;
}
}
return false;
//return TwosideKeeper.TwosideRecyclingCenter.nodes.contains(new Location(b.getWorld(),b.getLocation().getBlockX(),b.getLocation().getBlockY(),b.getLocation().getBlockZ()));
}
public void AddItemToRecyclingCenter(ItemStack i) {

@ -223,6 +223,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType;
import sig.plugin.TwosideKeeper.HelperStructures.BankSession;
import sig.plugin.TwosideKeeper.HelperStructures.BowMode;
import sig.plugin.TwosideKeeper.HelperStructures.BuffTemplate;
import sig.plugin.TwosideKeeper.HelperStructures.Channel;
import sig.plugin.TwosideKeeper.HelperStructures.DamageLabel;
import sig.plugin.TwosideKeeper.HelperStructures.CubeType;
@ -1427,13 +1428,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
recentnumbers.add(selectednumb);
},"roll");
aPlugin.API.addCommand(args->{
List<ItemStack> recyclingCenterItems = populateRecyclingCenterItems();
HashMap<String,List<ItemStack>> 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<ItemStack> recyclingCenterItems = populateRecyclingCenterItems();
HashMap<String,List<ItemStack>> 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,9 +3404,19 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
return false;
}
private static List<ItemStack> populateRecyclingCenterItems() {
List<ItemStack> recyclingCenterItems = new ArrayList<ItemStack>();
private static HashMap<String,List<ItemStack>> populateRecyclingCenterItems() {
HashMap<String,List<ItemStack>> recyclingCenterItems = new HashMap<String,List<ItemStack>>();
for (RecyclingCenterNode node : TwosideKeeper.TwosideRecyclingCenter.nodes) {
if (recyclingCenterItems.containsKey(node.getRecyclingCenterName())) {
recyclingCenterItems.get(node.getRecyclingCenterName()).addAll(populateRecyclingCenterItems(node));
} else {
recyclingCenterItems.put(node.getRecyclingCenterName(), new ArrayList<>(populateRecyclingCenterItems(node)));
}
}
return recyclingCenterItems;
}
private static List<ItemStack> populateRecyclingCenterItems(RecyclingCenterNode node) {
List<ItemStack> recyclingCenterItems = new ArrayList<ItemStack>();
BlockState bs = node.getRecyclingCenterLocation().getBlock().getState();
if (bs instanceof Chest) {
Chest c = (Chest)bs;
@ -3407,7 +3428,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} else {
TwosideKeeper.log("WARNING! Cannot find chest at Node location "+node.toString()+"!", 1);
}
}
return recyclingCenterItems;
}
private void setTier(ItemStack piece, int tier) {
@ -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")) {
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(), true, true);
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));

Loading…
Cancel
Save