diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index 3a226eb..22c5685 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index 85b05e9..0eb1b64 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper -version: 3.12.0 +version: 3.12.1 loadbefore: [aPlugin] commands: money: diff --git a/src/sig/plugin/TwosideKeeper/CustomDamage.java b/src/sig/plugin/TwosideKeeper/CustomDamage.java index 20da749..f54b0e4 100644 --- a/src/sig/plugin/TwosideKeeper/CustomDamage.java +++ b/src/sig/plugin/TwosideKeeper/CustomDamage.java @@ -808,16 +808,19 @@ public class CustomDamage { if (damage>2) { damage=2; } - GenericFunctions.SubtractSlayerModeHealth(p, damage); - //p.setHealth(pd.slayermodehp); - //damage=0; - if (GenericFunctions.hasStealth(p)) { - if (!ItemSet.meetsSlayerSwordConditions(ItemSet.STEALTH, 9, 1, p)) { - GenericFunctions.removeStealth(p); + if (pd.slayermodehp-damage>0) { + GenericFunctions.SubtractSlayerModeHealth(p, damage); + //p.setHealth(pd.slayermodehp); + //damage=0; + if (GenericFunctions.hasStealth(p)) { + if (!ItemSet.meetsSlayerSwordConditions(ItemSet.STEALTH, 9, 1, p)) { + GenericFunctions.removeStealth(p); + } } + } else { + GenericFunctions.AttemptRevive(p, damager, damage, reason); } damage=0; - GenericFunctions.AttemptRevive(p, damager, damage, reason); } else if (damage>0 && GenericFunctions.AttemptRevive(p, damager, damage, reason)) { damage=0; @@ -1288,7 +1291,7 @@ public class CustomDamage { GenericFunctions.RandomlyBreakBaubles(p); SoundUtils.playLocalSound(p, Sound.ENTITY_GENERIC_EAT, 1.0f, 1.0f); pd.lastrevivecandyconsumed=TwosideKeeper.getServerTickTime(); - aPlugin.API.sendCooldownPacket(p, Material.GOLDEN_APPLE, 400); + aPluginAPIWrapper.sendCooldownPacket(p, Material.GOLDEN_APPLE, 400); return 0; } } @@ -1365,8 +1368,8 @@ public class CustomDamage { if (consumed) { SoundUtils.playLocalSound(p, Sound.ENTITY_GENERIC_EAT, 1.0f, 1.0f); pd.lastcandyconsumed=TwosideKeeper.getServerTickTime(); - aPlugin.API.sendCooldownPacket(p, Material.GOLDEN_CARROT, 40); - aPlugin.API.sendCooldownPacket(p, Material.RAW_FISH, 40); + aPluginAPIWrapper.sendCooldownPacket(p, Material.GOLDEN_CARROT, 40); + aPluginAPIWrapper.sendCooldownPacket(p, Material.RAW_FISH, 40); } return damage; } @@ -1926,21 +1929,23 @@ public class CustomDamage { Block b = mon.getLocation().add(x,-1,z).getBlock(); if (aPlugin.API.isDestroyable(b) && GenericFunctions.isSoftBlock(b)) { //log(b.getType()+" is destroyable.",2); - @SuppressWarnings("deprecation") - FallingBlock fb = (FallingBlock)b.getLocation().getWorld().spawnFallingBlock(b.getLocation().add(0,0.1,0),b.getType(),(byte)0); - fb.setVelocity(new Vector(0,Math.random()*1.35,0)); - fb.setMetadata("FAKE", new FixedMetadataValue(TwosideKeeper.plugin,true)); - //b.breakNaturally(); - b.setType(Material.AIR); + if (!PVP.isPvPing(p)) { + @SuppressWarnings("deprecation") + FallingBlock fb = (FallingBlock)b.getLocation().getWorld().spawnFallingBlock(b.getLocation().add(0,0.1,0),b.getType(),(byte)0); + fb.setVelocity(new Vector(0,Math.random()*1.35,0)); + fb.setMetadata("FAKE", new FixedMetadataValue(TwosideKeeper.plugin,true)); + //b.breakNaturally(); + b.setType(Material.AIR); + } aPlugin.API.sendSoundlessExplosion(b.getLocation(), 1); - SoundUtils.playGlobalSound(mon.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1.0f, 1.0f); } } - } + } + SoundUtils.playGlobalSound(mon.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1.0f, 1.0f); } SoundUtils.playLocalSound(p, Sound.ENTITY_FIREWORK_LARGE_BLAST, 1.0f, 1.0f); - aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetModifiedCooldown(TwosideKeeper.ERUPTION_COOLDOWN,p)); + aPluginAPIWrapper.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetModifiedCooldown(TwosideKeeper.ERUPTION_COOLDOWN,p)); pd.last_shovelspell=TwosideKeeper.getServerTickTime()+GenericFunctions.GetModifiedCooldown(TwosideKeeper.ERUPTION_COOLDOWN,p); } } @@ -2440,7 +2445,7 @@ public class CustomDamage { pd.last_rejuvenate-=40; int remainingtime = GenericFunctions.GetRemainingCooldownTime(p, pd.last_rejuvenate, TwosideKeeper.REJUVENATE_COOLDOWN); if (remainingtime>0) { - aPlugin.API.sendCooldownPacket(p, Material.SHIELD, remainingtime); + aPluginAPIWrapper.sendCooldownPacket(p, Material.SHIELD, remainingtime); } } @@ -4190,8 +4195,8 @@ public class CustomDamage { pd.lastassassinatetime-=(int)(GenericFunctions.GetModifiedCooldown(TwosideKeeper.ASSASSINATE_COOLDOWN,(Player)shooter)*0.5); //TwosideKeeper.log("Subtracted "+(int)(GenericFunctions.GetModifiedCooldown(TwosideKeeper.ASSASSINATE_COOLDOWN,(Player)shooter)*0.5)+" ticks from Last Assassinate.", 0); if (name!=Material.SKULL_ITEM || pd.lastlifesavertime+GenericFunctions.GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN,(Player)shooter)0) { Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, this, 3); + } else { + aPluginAPIWrapper.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_arrowbarrage, 1)); + Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ + aPluginAPIWrapper.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_arrowbarrage, TwosideKeeper.ARROWBARRAGE_COOLDOWN)); + }, 1); } } - } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java index 8c76b19..b87d042 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java @@ -2009,12 +2009,14 @@ public class GenericFunctions { } public static String GetItemName(ItemStack item) { - if (item.hasItemMeta() && + String finalstring = ""; + if (item!=null && item.hasItemMeta() && item.getItemMeta().hasDisplayName()) { - return item.getItemMeta().getDisplayName(); + finalstring = item.getItemMeta().getDisplayName(); } else { - return UserFriendlyMaterialName(item); + finalstring = UserFriendlyMaterialName(item); } + return WorldShop.obfuscateAllMagicCodes(finalstring); } /** @@ -2781,9 +2783,13 @@ public class GenericFunctions { if (Math.random() <= repairamt%1) { repairamt++; } - if (p.getLocation().getY()>=0 && p.getLocation().getBlock().getLightFromSky()==0) { - repairamt/=2.0d; - //TwosideKeeper.log("In Darkness.",2); + try { + if (p.getLocation().getY()>=0 && p.getLocation().getBlock().getLightFromSky()==0) { + repairamt/=2.0d; + //TwosideKeeper.log("In Darkness.",2); + } + } catch (ArrayIndexOutOfBoundsException e) { + //API causes this to occur. } double chance = 1; if (Math.random()<=chance/100d) { @@ -2899,7 +2905,7 @@ public class GenericFunctions { Bukkit.getPluginManager().callEvent(ev); if (!ev.isCancelled()) { pd.last_dodge=TwosideKeeper.getServerTickTime(); - aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GetModifiedCooldown(TwosideKeeper.DODGE_COOLDOWN,p)); + aPluginAPIWrapper.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GetModifiedCooldown(TwosideKeeper.DODGE_COOLDOWN,p)); SoundUtils.playLocalSound(p, Sound.ENTITY_DONKEY_CHEST, 1.0f, 1.0f); int dodgeduration = 20; @@ -3199,7 +3205,7 @@ public class GenericFunctions { SoundUtils.playGlobalSound(player.getLocation(), Sound.ENTITY_ZOMBIE_VILLAGER_CURE, 1.0f, 1.0f); addIFrame(player,40); //GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.REGENERATION,200,9,player,true); - aPlugin.API.sendCooldownPacket(player, player.getEquipment().getItemInMainHand(), GetModifiedCooldown(TwosideKeeper.REJUVENATE_COOLDOWN,player)); + aPluginAPIWrapper.sendCooldownPacket(player, player.getEquipment().getItemInMainHand(), GetModifiedCooldown(TwosideKeeper.REJUVENATE_COOLDOWN,player)); } } @@ -3700,10 +3706,10 @@ public class GenericFunctions { public static boolean AttemptRevive(Player p, Entity damager, double dmg, String reason) { boolean revived=false; boolean fromRoom=false; - if (p.getHealth()<=dmg) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + if (p.getHealth()<=dmg || (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER && pd.slayermodehp<=dmg)) { //This means we would die from this attack. Attempt to revive the player. //Check all artifact armor for a perk. - PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); pd.lastdamagetaken=dmg; pd.lasthitdesc=reason; pd.slayermodehp = p.getMaxHealth(); @@ -3765,8 +3771,8 @@ public class GenericFunctions { revived=true; Bukkit.broadcastMessage(ChatColor.GOLD+p.getName()+ChatColor.WHITE+" should've died but managed to live!"); aPlugin.API.discordSendRawItalicized(ChatColor.GOLD+p.getName()+ChatColor.WHITE+" should've died but managed to live!"); - aPlugin.API.sendCooldownPacket(p, Material.SKULL_ITEM, GenericFunctions.GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN, p)); - aPlugin.API.sendCooldownPacket(p, Material.CHORUS_FLOWER, GenericFunctions.GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN, p)); + aPluginAPIWrapper.sendCooldownPacket(p, Material.SKULL_ITEM, GenericFunctions.GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN, p)); + aPluginAPIWrapper.sendCooldownPacket(p, Material.CHORUS_FLOWER, GenericFunctions.GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN, p)); //return true; } } @@ -3950,7 +3956,7 @@ public class GenericFunctions { TwosideKeeper.log("dmg mult is "+damage_mult,4); dmg = basedmg * damage_mult; if (ent instanceof Player) {TwosideKeeper.log("Damage is "+dmg, 5);} - CustomDamage.ApplyDamage(dmg, damager, (LivingEntity)ent, null, reason, CustomDamage.IGNORE_DAMAGE_TICK); + CustomDamage.ApplyDamage(dmg, CustomDamage.getDamagerEntity(damager), (LivingEntity)ent, null, reason, CustomDamage.IGNORE_DAMAGE_TICK); //subtractHealth((LivingEntity)nearbyentities.get(i),null,NewCombat.CalculateDamageReduction(dmg, (LivingEntity)nearbyentities.get(i), null)); } } @@ -4147,7 +4153,7 @@ public class GenericFunctions { Player p = (Player)damager; PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); pd.last_strikerspell = pd.last_strikerspell-40; - aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GetRemainingCooldownTime(p, pd.last_strikerspell, TwosideKeeper.LINEDRIVE_COOLDOWN)); + aPluginAPIWrapper.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GetRemainingCooldownTime(p, pd.last_strikerspell, TwosideKeeper.LINEDRIVE_COOLDOWN)); } updateNoDamageTickMap(m,(Player)damager); } @@ -4702,7 +4708,7 @@ public class GenericFunctions { logAndApplyPotionEffectToEntity(PotionEffectType.SLOW,(ex_version)?7:15,20,p); } if (!ex_version || second_charge) { - aPlugin.API.sendCooldownPacket(p, weaponused, GetModifiedCooldown(TwosideKeeper.LINEDRIVE_COOLDOWN,p)); + aPluginAPIWrapper.sendCooldownPacket(p, weaponused, GetModifiedCooldown(TwosideKeeper.LINEDRIVE_COOLDOWN,p)); pd.last_strikerspell=TwosideKeeper.getServerTickTime(); } SoundUtils.playLocalSound(p, Sound.UI_BUTTON_CLICK, 1.0f, 1.0f); @@ -4762,7 +4768,7 @@ public class GenericFunctions { if (ex_version) { Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() { public void run() { - aPlugin.API.sendCooldownPacket(p, weaponused, GetModifiedCooldown(TwosideKeeper.LINEDRIVE_COOLDOWN,p)); + aPluginAPIWrapper.sendCooldownPacket(p, weaponused, GetModifiedCooldown(TwosideKeeper.LINEDRIVE_COOLDOWN,p)); pd.last_strikerspell=TwosideKeeper.getServerTickTime(); } },17); @@ -4780,7 +4786,7 @@ public class GenericFunctions { SoundUtils.playGlobalSound(player.getLocation(), Sound.BLOCK_NOTE_SNARE, 1.0f, 1.0f); PlayerStructure pd = PlayerStructure.GetPlayerStructure(player); if (name!=Material.SKULL_ITEM || pd.lastlifesavertime+GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN,player)0) { pd.last_siphon=TwosideKeeper.getServerTickTime(); SoundUtils.playLocalSound(p, Sound.BLOCK_FENCE_GATE_OPEN, 1.0f, 0.4f); - aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GetModifiedCooldown(TwosideKeeper.SIPHON_COOLDOWN,p)); + aPluginAPIWrapper.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GetModifiedCooldown(TwosideKeeper.SIPHON_COOLDOWN,p)); for (LivingEntity ent : poisonlist) { //Refresh poison stacks if necessary. int totalpoisonlv = 0; @@ -5535,7 +5542,7 @@ public class GenericFunctions { new WindSlash(p.getLocation(),p,ItemSet.GetItemTier(p.getEquipment().getItemInMainHand())*windcharges,20*10)); p.setVelocity(p.getLocation().getDirection().multiply(-0.7f-(0.01f*(windcharges/10))*((p.isOnGround())?1d:2d))); GenericFunctions.sendActionBarMessage(p, "", true); - aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GetModifiedCooldown(TwosideKeeper.WINDSLASH_COOLDOWN,p)); + aPluginAPIWrapper.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GetModifiedCooldown(TwosideKeeper.WINDSLASH_COOLDOWN,p)); pd.lastusedwindslash = TwosideKeeper.getServerTickTime(); TwosideKeeper.sendSuccessfulCastMessage(p); } else { @@ -5559,7 +5566,7 @@ public class GenericFunctions { SoundUtils.playGlobalSound(p.getLocation(), Sound.ENTITY_GENERIC_DRINK, 1.0f, 1.0f); Buff.addBuff(p, "BEASTWITHIN", new Buff("Beast Within",(ItemSet.GetItemTier(p.getEquipment().getItemInMainHand())+ItemSet.BEASTWITHIN_DURATION)*20,1,org.bukkit.Color.MAROON,"♦",true,true)); GenericFunctions.sendActionBarMessage(p, "", true); - aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GetModifiedCooldown(TwosideKeeper.BEASTWITHIN_COOLDOWN,p)); + aPluginAPIWrapper.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GetModifiedCooldown(TwosideKeeper.BEASTWITHIN_COOLDOWN,p)); pd.lastusedbeastwithin=TwosideKeeper.getServerTickTime(); TwosideKeeper.sendSuccessfulCastMessage(p); } else { diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Effects/EarthWaveTask.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Effects/EarthWaveTask.java index 65bed45..7ea644e 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Effects/EarthWaveTask.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Effects/EarthWaveTask.java @@ -7,6 +7,7 @@ import org.bukkit.entity.FallingBlock; import org.bukkit.entity.Player; import org.bukkit.util.Vector; +import sig.plugin.TwosideKeeper.PVP; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; public class EarthWaveTask implements Runnable{ @@ -29,7 +30,7 @@ public class EarthWaveTask implements Runnable{ if (!damager.isDead()) { for (int x=-radius;x<=radius;x++) { //Start at the top y. Block b = centerpoint.getBlock().getRelative(x, 0, -radius); - if (GenericFunctions.isSoftBlock(b) && b.getRelative(0, 1, 0).getType()==Material.AIR) { + if (GenericFunctions.isSoftBlock(b) && b.getRelative(0, 1, 0).getType()==Material.AIR && !PVP.isPvPing(damager)) { FallingBlock fb = centerpoint.getWorld().spawnFallingBlock(b.getLocation().add(0,0,0), b.getType(), b.getData()); fb.setVelocity(new Vector(0,vel,0)); b.setType(Material.AIR); @@ -42,7 +43,7 @@ public class EarthWaveTask implements Runnable{ } for (int x=-radius;x<=radius;x++) { //Start at the top y. Block b = centerpoint.getBlock().getRelative(x, 0, radius); - if (GenericFunctions.isSoftBlock(b) && b.getRelative(0, 1, 0).getType()==Material.AIR) { + if (GenericFunctions.isSoftBlock(b) && b.getRelative(0, 1, 0).getType()==Material.AIR && !PVP.isPvPing(damager)) { FallingBlock fb = centerpoint.getWorld().spawnFallingBlock(b.getLocation().add(0,0,0), b.getType(), b.getData()); fb.setVelocity(new Vector(0,vel,0)); b.setType(Material.AIR); @@ -55,7 +56,7 @@ public class EarthWaveTask implements Runnable{ } for (int y=-radius+1;y2500) { + if (p.getWorld().equals(m.getWorld()) && p.getLocation().distanceSquared(m.getLocation())>576) { healthbar.removePlayer(p); } } - for (Entity e : m.getNearbyEntities(50, 50, 50)) { + for (Entity e : m.getNearbyEntities(24, 24, 24)) { if (e instanceof Player) { Player p = (Player)e; healthbar.addPlayer(p); @@ -398,4 +398,19 @@ public class GenericBoss extends CustomMonster{ } return amt; } + + //Returns the number of nearby bosses in the specified location (That inherit this class). + public static int nearbyBosses(Location loc, int range) { + int amt=0; + for (UUID id : TwosideKeeper.custommonsters.keySet()) { + CustomMonster cm = TwosideKeeper.custommonsters.get(id); + if (cm instanceof GenericBoss) { + GenericBoss gb = (GenericBoss)cm; + if (gb.GetMonster().getLocation().distanceSquared(loc)<2500) { + amt++; + } + } + } + return amt; + } } diff --git a/src/sig/plugin/TwosideKeeper/Monster/Knight.java b/src/sig/plugin/TwosideKeeper/Monster/Knight.java index 7451bc4..e75858c 100644 --- a/src/sig/plugin/TwosideKeeper/Monster/Knight.java +++ b/src/sig/plugin/TwosideKeeper/Monster/Knight.java @@ -939,8 +939,9 @@ public class Knight extends GenericBoss{ if ((TwosideKeeper.MINIBOSSES_ACTIVATED && //TwosideKeeper.LAST_SPECIAL_SPAWN+(3000/Math.max(Bukkit.getOnlinePlayers().size(),1))<=TwosideKeeper.getServerTickTime() && !m.getWorld().getName().contains("Instance") && - Math.random()<=0.05 && + Math.random()<=0.035 && TwosideKeeper.elitemonsters.size()==0 && + GenericBoss.nearbyBosses(m.getLocation(),50)==0 && //GenericBoss.bossCount()==0 && GenericFunctions.AllNaturalBlocks(m.getLocation().getBlock(),16,8,16)) || force) { Skeleton s = (Skeleton)m; diff --git a/src/sig/plugin/TwosideKeeper/Monster/SniperSkeleton.java b/src/sig/plugin/TwosideKeeper/Monster/SniperSkeleton.java index 3f25bcc..90d25c3 100644 --- a/src/sig/plugin/TwosideKeeper/Monster/SniperSkeleton.java +++ b/src/sig/plugin/TwosideKeeper/Monster/SniperSkeleton.java @@ -675,7 +675,8 @@ public class SniperSkeleton extends GenericBoss{ !m.getWorld().getName().contains("Instance") && Math.random()<=0.035 && TwosideKeeper.elitemonsters.size()==0 && - GenericBoss.bossCount()<2 && + //GenericBoss.bossCount()<2 && + GenericBoss.nearbyBosses(m.getLocation(),50)==0 && GenericFunctions.AllNaturalBlocks(m.getLocation().getBlock(),16,8,16)) || force) { Skeleton s = (Skeleton)m; s.setSkeletonType(SkeletonType.NORMAL); diff --git a/src/sig/plugin/TwosideKeeper/PVP.java b/src/sig/plugin/TwosideKeeper/PVP.java index 253dcc4..31e64ff 100644 --- a/src/sig/plugin/TwosideKeeper/PVP.java +++ b/src/sig/plugin/TwosideKeeper/PVP.java @@ -56,7 +56,7 @@ public class PVP { //NEUTRAL team //Team1 //Team2 etc - + public PVP(Player...players) { for (Player p : players) { this.players.put(p.getName(),new PVPPlayer()); @@ -103,7 +103,7 @@ public class PVP { for (String s : players.keySet()) { Player p = Bukkit.getPlayer(s); if (p!=null && p.isOnline()) { - Bukkit.getServer().broadcastMessage(ChatColor.YELLOW+""+ChatColor.ITALIC+" "+freshBloodPlayer+ChatColor.GRAY+" is a Fresh Blood player, doubling the drop rate of this match."); + p.sendMessage(ChatColor.YELLOW+""+ChatColor.ITALIC+" "+freshBloodPlayer+ChatColor.GRAY+" is a Fresh Blood player, doubling the drop rate of this match."); } } } @@ -130,16 +130,20 @@ public class PVP { if (!players.containsKey(p.getName())) { players.put(p.getName(), new PVPPlayer()); for (String s : players.keySet()) { + PVPPlayer pp = players.get(s); Player pl = Bukkit.getPlayer(s); if (pl!=null && pl.isValid() && pl.isOnline()) { pl.sendMessage(ChatColor.YELLOW+p.getName()+" has joined the match. Current Participants: "+ChatColor.YELLOW+getParticipants()); - findFreshBloodPlayer(); - announceFreshBloodPlayer(false); + if (!pp.isReady) { + showReadyChoice(s); + } } else { //pl.sendMessage(ChatColor.YELLOW+s+ChatColor.GOLD+" has left the PVP Match..."); leaveMatch(s); } } + findFreshBloodPlayer(); + announceFreshBloodPlayer(false); timer = TwosideKeeper.getServerTickTime(); } } @@ -623,8 +627,14 @@ public class PVP { private boolean AllPlayersOnTeamDead(int teamnumb) { List members = getPlayersInTeam(teamnumb); for (String s : members) { - PVPPlayer pp = players.get(s); - if (pp.isAlive) { + if (players.containsKey(s)) { + PVPPlayer pp = players.get(s); + if (pp.isAlive) { + return false; + } + } else { + DebugUtils.showStackTrace(); + TwosideKeeper.log("WARNING! This PVP Player ("+s+") was on a team but is not valid!", 1); return false; } } @@ -873,6 +883,7 @@ public class PVP { } else { TwosideKeeper.log("WARNING! There were no winners!", 1); } + freshBloodPlayer=null; } private void determineWinnerByEliminatingLosers() { @@ -1181,11 +1192,7 @@ public class PVP { for (String s : players.keySet()) { PVPPlayer pp = players.get(s); if (pp.team==i) { - if (freshBloodPlayer!=null && freshBloodPlayer.equalsIgnoreCase(s)) { - teams.add("*"+s); - } else { - teams.add(s); - } + teams.add(s); } } return teams; diff --git a/src/sig/plugin/TwosideKeeper/PVPArena.java b/src/sig/plugin/TwosideKeeper/PVPArena.java index a6cafd1..406d394 100644 --- a/src/sig/plugin/TwosideKeeper/PVPArena.java +++ b/src/sig/plugin/TwosideKeeper/PVPArena.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.util.Vector; @@ -18,6 +19,7 @@ public class PVPArena { String name; String desc; List safelocs; + List spawnlocs; public PVPArena(Location startCorner, Location endCorner, String arenaName, String desc) { this.startCorner = new Location(startCorner.getWorld(),Math.min(startCorner.getBlockX(), endCorner.getBlockX()),Math.min(startCorner.getBlockY(), endCorner.getBlockY()),Math.min(startCorner.getBlockZ(), endCorner.getBlockZ())); @@ -47,7 +49,7 @@ public class PVPArena { public Location pickRandomLocation() { //Pick a random point. - int tries=400; //Number of tries before we give up and drop them in. + int tries=500; //Number of tries before we give up and drop them in. int randomx = ((int)(Math.random()*(endCorner.getBlockX()-startCorner.getBlockX()))) + 1; int randomz = ((int)(Math.random()*(endCorner.getBlockZ()-startCorner.getBlockZ()))) + 1; @@ -70,6 +72,7 @@ public class PVPArena { startCorner.getBlockY()+y, startCorner.getBlockZ()+randomz+0.5); if (!finalloc.getBlock().isLiquid() && + finalloc.getBlock().getRelative(0, 1, 0).getType()==Material.AIR && insideBounds(finalloc)) { /*TwosideKeeper.log("Final Block is "+finalloc.getBlock(), 1); TwosideKeeper.log("Final Block Above is "+finalloc.getBlock().getRelative(0, 1, 0), 1); @@ -146,3 +149,19 @@ public class PVPArena { return sb.toString(); } } + +class Span { + Location startCorner; + Location endCorner; + Span(Location startCorner, Location endCorner) { + this.startCorner = new Location(startCorner.getWorld(),Math.min(startCorner.getBlockX(), endCorner.getBlockX()),Math.min(startCorner.getBlockY(), endCorner.getBlockY()),Math.min(startCorner.getBlockZ(), endCorner.getBlockZ())); + this.endCorner = new Location(startCorner.getWorld(),Math.max(startCorner.getBlockX(), endCorner.getBlockX()),Math.max(startCorner.getBlockY(), endCorner.getBlockY()),Math.max(startCorner.getBlockZ(), endCorner.getBlockZ())); + } + + Location getStartCorner() { + return startCorner.clone(); + } + Location getEndCorner() { + return endCorner.clone(); + } +} diff --git a/src/sig/plugin/TwosideKeeper/PlayerStructure.java b/src/sig/plugin/TwosideKeeper/PlayerStructure.java index 6cc4381..8a9b730 100644 --- a/src/sig/plugin/TwosideKeeper/PlayerStructure.java +++ b/src/sig/plugin/TwosideKeeper/PlayerStructure.java @@ -413,26 +413,26 @@ public class PlayerStructure { public static void setDefaultCooldowns(Player p) { PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); - aPlugin.API.sendCooldownPacket(p, Material.BOW, GenericFunctions.GetRemainingCooldownTime(p, pd.last_dodge, TwosideKeeper.DODGE_COOLDOWN)); + aPluginAPIWrapper.sendCooldownPacket(p, Material.BOW, GenericFunctions.GetRemainingCooldownTime(p, pd.last_dodge, TwosideKeeper.DODGE_COOLDOWN)); applyCooldownToAllTypes(p,"HOE",GenericFunctions.GetRemainingCooldownTime(p, pd.last_deathmark, TwosideKeeper.DEATHMARK_COOLDOWN)); applyCooldownToAllTypes(p,"SPADE",GenericFunctions.GetRemainingCooldownTime(p, pd.lastusedearthwave, TwosideKeeper.EARTHWAVE_COOLDOWN)); applyCooldownToAllTypes(p,"SWORD",GenericFunctions.GetRemainingCooldownTime(p, pd.last_strikerspell, TwosideKeeper.LINEDRIVE_COOLDOWN)); - aPlugin.API.sendCooldownPacket(p, Material.SHIELD, GenericFunctions.GetRemainingCooldownTime(p, pd.last_rejuvenate, TwosideKeeper.REJUVENATE_COOLDOWN)); - aPlugin.API.sendCooldownPacket(p, Material.SKULL_ITEM, GenericFunctions.GetRemainingCooldownTime(p, pd.lastlifesavertime, TwosideKeeper.LIFESAVER_COOLDOWN)); - aPlugin.API.sendCooldownPacket(p, Material.CHORUS_FLOWER, GenericFunctions.GetRemainingCooldownTime(p, pd.lastlifesavertime, TwosideKeeper.LIFESAVER_COOLDOWN)); - aPlugin.API.sendCooldownPacket(p, Material.WATCH, GenericFunctions.GetRemainingCooldownTime(p, pd.icewandused, TwosideKeeper.ICEWAND_COOLDOWN)); - aPlugin.API.sendCooldownPacket(p, Material.RAW_FISH, GenericFunctions.GetRemainingCooldownTime(p, pd.lastcandyconsumed, 40)); - aPlugin.API.sendCooldownPacket(p, Material.GOLDEN_APPLE, GenericFunctions.GetRemainingCooldownTime(p, pd.lastrevivecandyconsumed, 200)); + aPluginAPIWrapper.sendCooldownPacket(p, Material.SHIELD, GenericFunctions.GetRemainingCooldownTime(p, pd.last_rejuvenate, TwosideKeeper.REJUVENATE_COOLDOWN)); + aPluginAPIWrapper.sendCooldownPacket(p, Material.SKULL_ITEM, GenericFunctions.GetRemainingCooldownTime(p, pd.lastlifesavertime, TwosideKeeper.LIFESAVER_COOLDOWN)); + aPluginAPIWrapper.sendCooldownPacket(p, Material.CHORUS_FLOWER, GenericFunctions.GetRemainingCooldownTime(p, pd.lastlifesavertime, TwosideKeeper.LIFESAVER_COOLDOWN)); + aPluginAPIWrapper.sendCooldownPacket(p, Material.WATCH, GenericFunctions.GetRemainingCooldownTime(p, pd.icewandused, TwosideKeeper.ICEWAND_COOLDOWN)); + aPluginAPIWrapper.sendCooldownPacket(p, Material.RAW_FISH, GenericFunctions.GetRemainingCooldownTime(p, pd.lastcandyconsumed, 40)); + aPluginAPIWrapper.sendCooldownPacket(p, Material.GOLDEN_APPLE, GenericFunctions.GetRemainingCooldownTime(p, pd.lastrevivecandyconsumed, 200)); applyCooldownToAllTypes(p,"SWORD",GenericFunctions.GetRemainingCooldownTime(p, pd.lastusedwindslash, TwosideKeeper.WINDSLASH_COOLDOWN)); applyCooldownToAllTypes(p,"SWORD",GenericFunctions.GetRemainingCooldownTime(p, pd.lastusedbeastwithin, TwosideKeeper.BEASTWITHIN_COOLDOWN)); } private static void applyCooldownToAllTypes(Player p, String item, int cooldown) { - aPlugin.API.sendCooldownPacket(p, Material.valueOf("WOOD_"+item), cooldown); - aPlugin.API.sendCooldownPacket(p, Material.valueOf("IRON_"+item), cooldown); - aPlugin.API.sendCooldownPacket(p, Material.valueOf("STONE_"+item), cooldown); - aPlugin.API.sendCooldownPacket(p, Material.valueOf("DIAMOND_"+item), cooldown); - aPlugin.API.sendCooldownPacket(p, Material.valueOf("GOLD_"+item), cooldown); + aPluginAPIWrapper.sendCooldownPacket(p, Material.valueOf("WOOD_"+item), cooldown); + aPluginAPIWrapper.sendCooldownPacket(p, Material.valueOf("IRON_"+item), cooldown); + aPluginAPIWrapper.sendCooldownPacket(p, Material.valueOf("STONE_"+item), cooldown); + aPluginAPIWrapper.sendCooldownPacket(p, Material.valueOf("DIAMOND_"+item), cooldown); + aPluginAPIWrapper.sendCooldownPacket(p, Material.valueOf("GOLD_"+item), cooldown); } //Save the configuration. diff --git a/src/sig/plugin/TwosideKeeper/RecordKeeping.java b/src/sig/plugin/TwosideKeeper/RecordKeeping.java index d58089d..832d9d7 100644 --- a/src/sig/plugin/TwosideKeeper/RecordKeeping.java +++ b/src/sig/plugin/TwosideKeeper/RecordKeeping.java @@ -33,8 +33,8 @@ public class RecordKeeping { public RecordKeeping(String displayName, boolean reverse) { this.name=displayName; recordlist = new ArrayList(); - loadRecordsFromConfig(); this.reverse=reverse; + loadRecordsFromConfig(); } public String getName() { @@ -225,21 +225,29 @@ public class RecordKeeping { } private void sortRecords() { + //TwosideKeeper.log(name+": Reverse? "+reverse, 2); List sortedrecords = new ArrayList(); + //TwosideKeeper.log("Record List: "+recordlist, 2); while (recordlist.size()>0) { Record bestrecord = null; int slot = 0; for (int i=0;ibestrecord.getScore())) { + //TwosideKeeper.log(" Beats Record: "+(bestrecord==null?"Null":bestrecord)+" Reverse? "+reverse, 2); bestrecord = rec; slot = i; + //TwosideKeeper.log(" New Record:"+bestrecord, 2); } } sortedrecords.add(recordlist.remove(slot)); + //TwosideKeeper.log("Record List: "+recordlist, 2); + //TwosideKeeper.log("Sorted Records: "+sortedrecords, 2); } recordlist = sortedrecords; + //TwosideKeeper.log("FINAL Record List: "+recordlist, 2); } } class Record{ @@ -269,4 +277,15 @@ class Record{ public void setMode(PlayerMode mode) { this.mode = mode; } + public String toString() { + StringBuilder sb = new StringBuilder("Record{"); + sb.append("name="); + sb.append(name); + sb.append(",score="); + sb.append(score); + sb.append(",mode="); + sb.append(mode); + sb.append("}"); + return sb.toString(); + } } diff --git a/src/sig/plugin/TwosideKeeper/Rooms/DPSChallengeRoom.java b/src/sig/plugin/TwosideKeeper/Rooms/DPSChallengeRoom.java index 6183a1f..e252ed9 100644 --- a/src/sig/plugin/TwosideKeeper/Rooms/DPSChallengeRoom.java +++ b/src/sig/plugin/TwosideKeeper/Rooms/DPSChallengeRoom.java @@ -74,7 +74,7 @@ public class DPSChallengeRoom extends Room{ pd.locBeforeInstance = p.getLocation().clone(); pd.inTankChallengeRoom=true; p.teleport(new Location(instance,ROOM_WIDTH/2,4,ROOM_LENGTH/2)); - //GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.LEVITATION, 20*4, -30, p, true); + GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.LEVITATION, 2, -30, p, true); Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ setupChallengeRoom(); }, 5); diff --git a/src/sig/plugin/TwosideKeeper/Rooms/ParkourChallengeRoom.java b/src/sig/plugin/TwosideKeeper/Rooms/ParkourChallengeRoom.java index 9262d75..eec4750 100644 --- a/src/sig/plugin/TwosideKeeper/Rooms/ParkourChallengeRoom.java +++ b/src/sig/plugin/TwosideKeeper/Rooms/ParkourChallengeRoom.java @@ -54,7 +54,7 @@ public class ParkourChallengeRoom extends Room{ PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); pd.locBeforeInstance = p.getLocation().clone(); pd.inParkourChallengeRoom=true; - //GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.LEVITATION, 20*4, -30, p, true); + GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.LEVITATION, 2, -30, p, true); p.teleport(new Location(instance,ROOM_WIDTH/2,4,ROOM_LENGTH/2)); storedinv = Bukkit.createInventory(p, 63); for (int i=0;i{ setupChallengeRoom(); }, 5); diff --git a/src/sig/plugin/TwosideKeeper/SpleefManager.java b/src/sig/plugin/TwosideKeeper/SpleefManager.java index 78132f8..076d2f5 100644 --- a/src/sig/plugin/TwosideKeeper/SpleefManager.java +++ b/src/sig/plugin/TwosideKeeper/SpleefManager.java @@ -57,6 +57,6 @@ public class SpleefManager { } public static boolean playerIsPlayingSpleef(Player p) { - return PlayerStructure.GetPlayerStructure(p).isPlayingSpleef || PlayerStructure.GetPlayerStructure(p).inTankChallengeRoom; + return PlayerStructure.GetPlayerStructure(p).isPlayingSpleef || PlayerStructure.GetPlayerStructure(p).inTankChallengeRoom || PVP.isPvPing(p); } } \ No newline at end of file diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index c00b785..723f01d 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -1,7 +1,13 @@ package sig.plugin.TwosideKeeper; +import java.io.BufferedReader; import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URL; +import java.net.URLConnection; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; @@ -475,7 +481,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public static final int REJUVENATE_COOLDOWN=6000; public static final int ASSASSINATE_COOLDOWN=200; public static final int LIFESAVER_COOLDOWN=6000; - public static final int ARROWBARRAGE_COOLDOWN=2400; + public static final int ARROWBARRAGE_COOLDOWN=200; public static final int SIPHON_COOLDOWN = 900; public static final int MOCK_COOLDOWN = 400; public static final int ICEWAND_COOLDOWN = 1200; @@ -1355,7 +1361,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { /*MonsterTemplate newtemp = new MonsterTemplate(new File(filesave+"/monsterdata/KingSlime.md")); int newint = (int)newtemp.getValue("timeToLive"); log(Integer.toString(newint),0);*/ - log(" This is here to change the file size if necessary Kappa Kappa Kappa No Copy-pasterino Kappachino Lulu c: Please update version number. lololol cy@ storm is boosted. This is nice.",5); + log(" lolol. This is here to change the file size if necessary Kappa Kappa Kappa No Copy-pasterino Kappachino Lulu c: Please update version number. lololol cy@ storm is boosted. This is nice.",5); } private static void InitializeBotCommands() { @@ -2601,6 +2607,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } } }break; + case "MINIBOSSES":{ + p.sendMessage("There are "+(GenericBoss.nearbyBosses(p.getLocation(),50))+" Minibosses nearby."); + }break; } } //LivingEntity m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), MonsterDifficulty.ELITE); @@ -3887,16 +3896,169 @@ public class TwosideKeeper extends JavaPlugin implements Listener { playMessageNotification(ev.getPlayer()); int pos = -1; log(ev.getMessage()+" "+ev.getMessage().indexOf(" []"),5); - if (ev.getMessage().equalsIgnoreCase("[]") || ev.getMessage().indexOf(" []")>-1 || (ev.getMessage().indexOf("[] ")>-1 && ev.getMessage().indexOf("[] ")==0)) { + + List targetitem = new ArrayList(); + ItemStack[] tempitems = null; + Player p = ev.getPlayer(); + int marker = 0; + byte[] messagebytes = ev.getMessage().getBytes(); + TextComponent finalmsg = new TextComponent("<"+p.getName()+"> "); + TextComponent finalmsgDiscord = new TextComponent(""); + for (int i=0;i0) { + finalmsg.addExtra("\n"); + finalmsgDiscord.addExtra("\n"); + } + finalmsg.addExtra(tc); + finalmsgDiscord.addExtra("**"); + finalmsgDiscord.addExtra(tc); + finalmsgDiscord.addExtra("**"); + if (tempitems[j]!=null && tempitems[j].getType()!=Material.AIR) { + targetitem.add(tempitems[j]); + } + } + tempitems = null; + i+=advanceamt; + continue; + } + } + } + finalmsg.addExtra(String.valueOf(Character.toChars(messagebytes[i]))); + finalmsgDiscord.addExtra(String.valueOf(Character.toChars(messagebytes[i]))); + } + //p.spigot().sendMessage(finalmsg); + for (Player pl : Bukkit.getOnlinePlayers()) { + pl.spigot().sendMessage(finalmsg); + } + if (targetitem.size()>0) { + File record = null; + File record_folder = null; + File recordresult = null; + long serverTickTime = TwosideKeeper.getServerTickTime(); + if (SERVER_TYPE==ServerType.MAIN) { + record = new File("/var/www/html/items/records/"+serverTickTime); + record_folder = new File("/var/www/html/items/records/"); + recordresult = new File("/var/www/html/items/results/"+serverTickTime+".png"); + } else { + record = new File(getDataFolder()+"/itemrecords/"+serverTickTime); + record_folder = new File(getDataFolder()+"/itemrecords/"); + } + final String delimiter = "~!@#$%^&*()"; + try { + if (!record_folder.exists()) { + record_folder.mkdirs(); + } + if (!record.exists()) { + record.createNewFile(); + } + FileWriter writer = new FileWriter(record,true); + for (int j=0;j-1 || (ev.getMessage().indexOf("[] ")>-1 && ev.getMessage().indexOf("[] ")==0)) { pos = ev.getMessage().indexOf("[]"); ev.setMessage(ev.getMessage().replace("[]", "")); log("pos is "+pos+" message is: {"+ev.getMessage()+"}",5); //aPlugin.API.discordSendRaw(("**"+ev.getPlayer().getName()+"** "+ev.getMessage().substring(0, pos)+"**["+ChatColor.stripColor(GenericFunctions.GetItemName(ev.getPlayer().getEquipment().getItemInMainHand()))+((ev.getPlayer().getEquipment().getItemInMainHand().getAmount()>1)?" x"+ev.getPlayer().getEquipment().getItemInMainHand().getAmount():"")+"]**"+"\n```"+WorldShop.GetItemInfo(ev.getPlayer().getEquipment().getItemInMainHand())+" ```\n"+ev.getMessage().substring(pos))); + aPlugin.API.discordSendChat(ev.getPlayer().getName(), ev.getMessage().substring(0, pos)+"**["+ChatColor.stripColor(GenericFunctions.GetItemName(ev.getPlayer().getEquipment().getItemInMainHand()))+((ev.getPlayer().getEquipment().getItemInMainHand().getAmount()>1)?" x"+ev.getPlayer().getEquipment().getItemInMainHand().getAmount():"")+"]**"+"\n```\n"+WorldShop.GetItemInfo(ev.getPlayer().getEquipment().getItemInMainHand())+"\n```\n"+ev.getMessage().substring(pos)); Bukkit.dispatchCommand(Bukkit.getConsoleSender(),"tellraw @a [\"\",{\"text\":\"<"+ev.getPlayer().getName()+"> \"},{\"text\":\""+ev.getMessage().substring(0, pos)+"\"},{\"text\":\""+ChatColor.GREEN+"["+GenericFunctions.GetItemName(ev.getPlayer().getEquipment().getItemInMainHand())+ChatColor.RESET+ChatColor.YELLOW+((ev.getPlayer().getEquipment().getItemInMainHand().getAmount()>1)?" x"+ev.getPlayer().getEquipment().getItemInMainHand().getAmount():"")+ChatColor.GREEN+"]"+ChatColor.WHITE+"\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""+GenericFunctions.GetItemName(ev.getPlayer().getEquipment().getItemInMainHand())+""+WorldShop.GetItemInfo(ev.getPlayer().getEquipment().getItemInMainHand()).replace("\"", "\\\"")+"\"}},{\"text\":\""+ev.getMessage().substring(pos)+"\"}]"); + ev.setCancelled(true); - } + }*/ //if (ev.getMessage().matches("[0]")) //Bukkit.dispatchCommand(Bukkit.getConsoleSender(),"tellraw @a [\"\",{\"text\":\""+ChatColor.GREEN+"[Item]"+ChatColor.WHITE+"\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""+(ev.getPlayer().getEquipment().getItemInMainHand().getType())+"\"}},{\"text\":\" "+ev.getMessage().substring(0, pos)+" \"}]"); } @@ -4052,7 +4214,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { temporary_ice_list.add(new TemporaryIce(20,ent.getLocation().getBlock().getRelative(0, y, 0),ent)); } SoundUtils.playGlobalSound(p.getLocation(), Sound.BLOCK_PORTAL_TRIGGER, 0.7f, 1.6f); - aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetModifiedCooldown(TwosideKeeper.ICEWAND_COOLDOWN,p)); + aPluginAPIWrapper.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetModifiedCooldown(TwosideKeeper.ICEWAND_COOLDOWN,p)); pd.icewandused=TwosideKeeper.getServerTickTime(); return; } @@ -4375,21 +4537,21 @@ public class TwosideKeeper extends JavaPlugin implements Listener { GenericFunctions.setBowMode(p,BowMode.SNIPE); //GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand()); p.updateInventory(); - aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_arrowbarrage, ARROWBARRAGE_COOLDOWN)); + aPluginAPIWrapper.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_arrowbarrage, ARROWBARRAGE_COOLDOWN)); }break; case SNIPE:{ SoundUtils.playLocalSound(p, Sound.BLOCK_BREWING_STAND_BREW, 0.5f, 0.1f); GenericFunctions.setBowMode(p,BowMode.DEBILITATION); //GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand()); p.updateInventory(); - aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_siphon, SIPHON_COOLDOWN)); + aPluginAPIWrapper.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_siphon, SIPHON_COOLDOWN)); }break; case DEBILITATION:{ SoundUtils.playLocalSound(p, Sound.BLOCK_CHEST_LOCKED, 0.5f, 3.5f); GenericFunctions.setBowMode(p,BowMode.CLOSE); //GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand()); p.updateInventory(); - aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_dodge, DODGE_COOLDOWN)); + aPluginAPIWrapper.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_dodge, DODGE_COOLDOWN)); }break; } pd.lastbowmodeswitch=getServerTickTime(); @@ -4436,7 +4598,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } SoundUtils.playLocalSound(p, Sound.ENTITY_FIREWORK_LARGE_BLAST, 1.0f, 1.0f); - /*aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetModifiedCooldown(TwosideKeeper.ERUPTION_COOLDOWN,p)); + /*aPluginAPIWrapper.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetModifiedCooldown(TwosideKeeper.ERUPTION_COOLDOWN,p)); pd.last_shovelspell=TwosideKeeper.getServerTickTime()+GenericFunctions.GetModifiedCooldown(TwosideKeeper.ERUPTION_COOLDOWN,p);*/ pd.lastusedearthwave=TwosideKeeper.getServerTickTime(); aPlugin.API.damageItem(p, weapon, (int) (weapon.getType().getMaxDurability()*0.05+5)); @@ -5322,7 +5484,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (Buff.hasBuff(m, "DeathMark") && !m.isDead()) { //This has stacks, burst! bursted=true; - aPlugin.API.sendCooldownPacket(player, player.getEquipment().getItemInMainHand(), 240); + aPluginAPIWrapper.sendCooldownPacket(player, player.getEquipment().getItemInMainHand(), 240); pd.last_deathmark = getServerTickTime(); int stackamt = GenericFunctions.GetDeathMarkAmt(m); //GenericFunctions.DealDamageToMob(stackamt*dmg, m, player, null, "Death Mark"); @@ -5344,7 +5506,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } if (reset) { pd.last_deathmark = getServerTickTime()-GenericFunctions.GetModifiedCooldown(TwosideKeeper.DEATHMARK_COOLDOWN,player)+20; - aPlugin.API.sendCooldownPacket(player, player.getEquipment().getItemInMainHand(), 10); + aPluginAPIWrapper.sendCooldownPacket(player, player.getEquipment().getItemInMainHand(), 10); } } } @@ -5388,6 +5550,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener { ev.setCancelled(true); return; } + if (PVP.isPvPing(ev.getPlayer())) { + ev.setCancelled(true); + return; + } Christmas.FillChristmasBox(ev.getPlayer(), ev.getItemInHand(), ev.getBlockPlaced()); if (!Christmas.ChristmasPlaceEvent(ev)) { @@ -6146,9 +6312,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener { SoundUtils.playLocalSound(p, Sound.ENTITY_VILLAGER_AMBIENT, 1.0f, 0.3f); aPlugin.API.displayEndRodParticle(p.getLocation(), 0, 0f, 0f, 5, 20); if (hasFullSet) { - aPlugin.API.sendCooldownPacket(p, ev.getItemDrop().getItemStack().getType(), GenericFunctions.GetModifiedCooldown(TwosideKeeper.MOCK_COOLDOWN/2,ev.getPlayer())); + aPluginAPIWrapper.sendCooldownPacket(p, ev.getItemDrop().getItemStack().getType(), GenericFunctions.GetModifiedCooldown(TwosideKeeper.MOCK_COOLDOWN/2,ev.getPlayer())); } else { - aPlugin.API.sendCooldownPacket(p, ev.getItemDrop().getItemStack().getType(), GenericFunctions.GetModifiedCooldown(TwosideKeeper.MOCK_COOLDOWN,ev.getPlayer())); + aPluginAPIWrapper.sendCooldownPacket(p, ev.getItemDrop().getItemStack().getType(), GenericFunctions.GetModifiedCooldown(TwosideKeeper.MOCK_COOLDOWN,ev.getPlayer())); } sendSuccessfulCastMessage(p); } else { @@ -8555,7 +8721,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { ItemStack[] inv = p.getInventory().getContents(); for (int i=0;i<9;i++) { if (inv[i]!=null && (inv[i].getType()!=Material.SKULL_ITEM || pd.lastlifesavertime+GenericFunctions.GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN,p){ - ItemStack tempitem = p.getInventory().getItem(slot); - Location loc = p.getLocation().clone(); - pd.weaponUsedForShooting = tempitem; - //p.getEquipment().setItemInMainHand(new ItemStack(Material.AIR)); - p.getInventory().setItem(slot, new ItemStack(Material.AIR)); - Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, ()->{ - if (p!=null && p.isValid()) { - p.getInventory().setItem(slot, tempitem); - //p.getEquipment().setItemInMainHand(tempitem); - } else { - GenericFunctions.dropItem(tempitem, loc); - } - }, 1); - }, 1); - } - } - //Arrow newarrow = arr.getLocation().getWorld().spawnArrow(arr.getLocation(), arr.getVelocity(), 1, 12); //TwosideKeeper.log(GenericFunctions.GetEntityDisplayName(arr)+" being shot.", 0); if (arr instanceof Fireball && (arr.getShooter() instanceof Ghast)) { @@ -10791,7 +10938,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } },20); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); - if (pd.linkplayer!=null && pd.linkplayer.isValid() && pd.lastlinkteleport+20