diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index ea6ee37..a2a0640 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index 1c080f7..177a8e5 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper -version: 3.4.7c +version: 3.4.7d commands: money: description: Tells the player the amount of money they are holding. @@ -71,4 +71,9 @@ commands: description: Teleports to a location in a specified world. usage: /tp_world permission: TwosideKeeper.tp_world + permission-message: No permissions! + stats: + description: Display statistics for damage and defense. + usage: /stats [username] + permission: TwosideKeeper.money permission-message: No permissions! \ No newline at end of file diff --git a/src/sig/plugin/TwosideKeeper/AutoUpdatePlugin.java b/src/sig/plugin/TwosideKeeper/AutoUpdatePlugin.java index 6107a55..54553f6 100644 --- a/src/sig/plugin/TwosideKeeper/AutoUpdatePlugin.java +++ b/src/sig/plugin/TwosideKeeper/AutoUpdatePlugin.java @@ -76,13 +76,13 @@ public class AutoUpdatePlugin implements Runnable { DiscordMessageSender.sendItalicizedRawMessageDiscord("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(i).name+". The server will restart in 3 minutes!"); Bukkit.broadcastMessage("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(i).name+". The server will restart in 3 minutes!"); //Move the file to the new location. - try { + /*try { FileUtils.copyFile(new File(TwosideKeeper.filesave,"updates/"+plugins.get(i).name), new File(TwosideKeeper.filesave,"../"+plugins.get(i).name+".jar")); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); - } + }*/ } } if (restarting) { diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java index 9ec9b2b..530011b 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java @@ -83,7 +83,7 @@ public class Loot { return enchantment_level; } - private static ItemStack addEnchantments(ItemStack item, boolean hardened) { + public static ItemStack addEnchantments(ItemStack item, boolean hardened) { if (GenericFunctions.isHarvestingTool(item)) { item.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, GetEnchantmentLevels(item.getType(),hardened)); item.addUnsafeEnchantment(Enchantment.DIG_SPEED, GetEnchantmentLevels(item.getType(),hardened)); @@ -123,7 +123,7 @@ public class Loot { if (Math.random()<0.2*HARDENED_ENCHANT_MULT && item.getType().toString().contains("HELMET")) {item.addUnsafeEnchantment(Enchantment.OXYGEN, 3);} if (Math.random()<0.2*HARDENED_ENCHANT_MULT && item.getType().toString().contains("BOOTS")) {item.addUnsafeEnchantment(Enchantment.FROST_WALKER, GetEnchantmentLevels(item.getType(),hardened));} if (Math.random()<0.08*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.THORNS, GetEnchantmentLevels(item.getType(),hardened));} - item.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1); + //item.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1); if (Math.random()<0.001*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.MENDING, GetEnchantmentLevels(item.getType(),hardened));} } else if (item.getType()==Material.FISHING_ROD) { diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java b/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java index c8ce791..ded820a 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java @@ -167,7 +167,7 @@ public enum MonsterDifficulty { this.loot_regular.length>0) { //This is a common roll. ItemStack gen_loot = DistributeRandomLoot(this.loot_regular); - TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 2); + TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4); droplist.add(gen_loot); } //Rare Loot roll. @@ -175,21 +175,23 @@ public enum MonsterDifficulty { this.loot_rare.length>0) { //This is a common roll. ItemStack gen_loot = DistributeRandomLoot(this.loot_rare); - TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 2); + TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4); droplist.add(gen_loot); + if (Math.random()<=0.2) { switch (this) { - case DANGEROUS: - droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ANCIENT_ESSENCE)); - break; - case DEADLY: - droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.LOST_ESSENCE)); - break; - case HELLFIRE: - droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_ESSENCE)); - break; - case NORMAL: - droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE)); - break; + case DANGEROUS: + droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ANCIENT_ESSENCE)); + break; + case DEADLY: + droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.LOST_ESSENCE)); + break; + case HELLFIRE: + droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_ESSENCE)); + break; + case NORMAL: + droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE)); + break; + } } } //Legendary Loot roll. @@ -197,33 +199,35 @@ public enum MonsterDifficulty { this.loot_legendary.length>0) { //This is a common roll. ItemStack gen_loot = DistributeRandomLoot(this.loot_legendary); - TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 2); + TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4); droplist.add(gen_loot); + if (Math.random()<=0.2) { switch (this) { - case DANGEROUS: - droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ANCIENT_CORE)); - break; - case DEADLY: - droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.LOST_CORE)); - break; - case HELLFIRE: - droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE)); - break; - case NORMAL: - droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ARTIFACT_CORE)); - break; + case DANGEROUS: + droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ANCIENT_CORE)); + break; + case DEADLY: + droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.LOST_CORE)); + break; + case HELLFIRE: + droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE)); + break; + case NORMAL: + droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ARTIFACT_CORE)); + break; + } } } if (isBoss) { //50% of the time, we drop something great. if (Math.random()<=0.5 && this.loot_legendary.length>0) { ItemStack gen_loot = DistributeRandomLoot(this.loot_legendary); - TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 2); + TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4); droplist.add(gen_loot); } else if (this.loot_rare.length>0) { //Consolation Prize. ItemStack gen_loot = DistributeRandomLoot(this.loot_rare); - TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 2); + TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4); droplist.add(gen_loot); } } diff --git a/src/sig/plugin/TwosideKeeper/MonsterController.java b/src/sig/plugin/TwosideKeeper/MonsterController.java index 1fc0907..3475f89 100644 --- a/src/sig/plugin/TwosideKeeper/MonsterController.java +++ b/src/sig/plugin/TwosideKeeper/MonsterController.java @@ -26,6 +26,7 @@ import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import sig.plugin.TwosideKeeper.HelperStructures.ItemRarity; +import sig.plugin.TwosideKeeper.HelperStructures.Loot; import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty; import sig.plugin.TwosideKeeper.HelperStructures.MonsterType; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; @@ -496,70 +497,7 @@ public class MonsterController { return RandomizeEnchantments(item, ItemRarity.VANILLA); } private static ItemStack RandomizeEnchantments(ItemStack item, ItemRarity rarity) { - //Have a small chance to randomize every enchant with a random value too. - switch (rarity) { - case RARE: - { - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*4)+2);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*4)+2);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*4)+2);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, (int)(Math.random()*4)+2);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*4)+2);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.OXYGEN, (int)(Math.random()*2)+2);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.WATER_WORKER, (int)(Math.random()*1)+1);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*2)+2);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.DEPTH_STRIDER, (int)(Math.random()*2)+2);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.FROST_WALKER, (int)(Math.random()*1)+2);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.DURABILITY, (int)(Math.random()*2)+2);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.MENDING, (int)(Math.random()*1)+1);} - }break; - case EPIC: - { - if (Math.random()<=0.12) {item.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*7)+2);} - if (Math.random()<=0.12) {item.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*7)+2);} - if (Math.random()<=0.12) {item.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*7)+2);} - if (Math.random()<=0.12) {item.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, (int)(Math.random()*7)+2);} - if (Math.random()<=0.12) {item.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*7)+2);} - if (Math.random()<=0.12) {item.addUnsafeEnchantment(Enchantment.OXYGEN, (int)(Math.random()*7)+2);} - if (Math.random()<=0.12) {item.addUnsafeEnchantment(Enchantment.WATER_WORKER, (int)(Math.random()*7)+2);} - if (Math.random()<=0.12) {item.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*7)+2);} - if (Math.random()<=0.12) {item.addUnsafeEnchantment(Enchantment.DEPTH_STRIDER, (int)(Math.random()*7)+2);} - if (Math.random()<=0.12) {item.addUnsafeEnchantment(Enchantment.FROST_WALKER, (int)(Math.random()*7)+2);} - if (Math.random()<=0.12) {item.addUnsafeEnchantment(Enchantment.DURABILITY, (int)(Math.random()*7)+2);} - if (Math.random()<=0.12) {item.addUnsafeEnchantment(Enchantment.MENDING, (int)(Math.random()*1)+1);} - }break; - case LEGENDARY: - { - if (Math.random()<=0.16) {item.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*6)+5);} - if (Math.random()<=0.16) {item.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*6)+5);} - if (Math.random()<=0.16) {item.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*6)+5);} - if (Math.random()<=0.16) {item.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, (int)(Math.random()*6)+5);} - if (Math.random()<=0.16) {item.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*6)+5);} - if (Math.random()<=0.16) {item.addUnsafeEnchantment(Enchantment.OXYGEN, (int)(Math.random()*6)+5);} - if (Math.random()<=0.16) {item.addUnsafeEnchantment(Enchantment.WATER_WORKER, (int)(Math.random()*6)+5);} - if (Math.random()<=0.16) {item.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*6)+5);} - if (Math.random()<=0.16) {item.addUnsafeEnchantment(Enchantment.DEPTH_STRIDER, (int)(Math.random()*6)+5);} - if (Math.random()<=0.16) {item.addUnsafeEnchantment(Enchantment.FROST_WALKER, (int)(Math.random()*6)+5);} - if (Math.random()<=0.16) {item.addUnsafeEnchantment(Enchantment.DURABILITY, (int)(Math.random()*6)+5);} - if (Math.random()<=0.16) {item.addUnsafeEnchantment(Enchantment.MENDING, (int)(Math.random()*1)+1);} - }break; - default: //Vanilla. - { - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*5)+1);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*5)+1);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*5)+1);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, (int)(Math.random()*5)+1);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*5)+1);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.OXYGEN, (int)(Math.random()*3)+1);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.WATER_WORKER, (int)(Math.random()*1)+1);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*3)+1);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.DEPTH_STRIDER, (int)(Math.random()*3)+1);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.FROST_WALKER, (int)(Math.random()*2)+1);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.DURABILITY, (int)(Math.random()*3)+1);} - if (Math.random()<=0.08) {item.addUnsafeEnchantment(Enchantment.MENDING, (int)(Math.random()*1)+1);} - }break; - } - return item; + return Loot.addEnchantments(item, false); } public static boolean isZombieLeader(LivingEntity ent) { @@ -646,6 +584,8 @@ public class MonsterController { m.setHealth(m.getMaxHealth()); if (m.getType()!=EntityType.ENDERMAN) { m.setFireTicks(999999); + } else { + m.setFireTicks(120); } if (isAllowedToEquipItems(m)) { m.getEquipment().clear(); diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index 943cfcd..a971965 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -519,15 +519,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { PartyList.get(j).IsInSameRegion(p)) { inParty=true; //Do party cleanups. - } /*else - if (PartyList.get(j).IsInParty(p) && - !PartyList.get(j).IsInSameRegion(p) && - PartyList.get(j).PlayerCountInParty()==1) { - //We're the only one in the party...why not - //just move it? - inParty=true; - PartyList.get(j).UpdateRegion(p.getLocation()); - }*/ + } } //Alright, none exist. Try to make a new party. @@ -756,6 +748,22 @@ public class TwosideKeeper extends JavaPlugin implements Listener { sender.sendMessage("Wrong arguments!"); } return true; + } else + if (cmd.getName().equalsIgnoreCase("stats")) { + if (args.length==1) { + if (Bukkit.getPlayer(args[0])!=null) { + //If we can grab their stats, then calculate it. + Player p = Bukkit.getPlayer(args[0]); + sender.sendMessage("Display stats for "+ChatColor.YELLOW+p.getName()); + showPlayerStats(p); + } else { + sender.sendMessage("Player "+ChatColor.YELLOW+args[0]+" is not online!"); + } + return true; + } else { + showPlayerStats((Player)sender); + return true; + } } } else { //Implement console/admin version later (Let's you check any name's money.) @@ -788,6 +796,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener { @EventHandler(priority=EventPriority.LOW) public void onPlayerJoin(PlayerJoinEvent ev) { + + //Remove stray members from the player's party. + + for (int j=0;j20) { - while (health>20) { - color1++; - color2++; - health-=20; + final String finalMonsterName = MonsterName; + String heartdisplay = "", remainingheartdisplay = ""; + int color1=0,color2=1; + double health=pd2.target.getHealth(); + double maxhealth=pd2.target.getMaxHealth(); + if (health>20) { + while (health>20) { + color1++; + color2++; + health-=20; + } } - } - for (int i=0;i20) { - for (int i=0;i<10;i++) { - heartdisplay+=Character.toString((char)0x2665); + for (int i=0;i20) { + for (int i=0;i<10;i++) { + heartdisplay+=Character.toString((char)0x2665); + } + } else { + for (int i=0;i