->Fix a bug with items renamed by anvils to create never-ending mode

strings on an item.
->Fix a bug with the server automatically restarting on plugin updates
when there were still players online.
->Headshot hitbox size is now a factor of how far back the bow is drawn.
Barely drawing the bow back leads to a much smaller headshot hitbox.
->Sniping Mode for Rangers has been modified: Headshot damage increase
starts at x2 damage. This amount increases by x0.25 for every level of
Slowness the Sniper obtains. For every shot hit, the Slowness stack
increases by one level, and refreshes the duration of Slowness (5 second
duration) up to 8 stacks. At Level 8 Slowness, a sniper's headshots
deals x4.0 damage. When Slowness wears off, your damage counter resets.
This allows you to move around while not sniping without having to
change modes.
->Sniping Mode now costs 3x normal durability for each arrow shot.
This commit is contained in:
sigonasr2 2016-07-17 15:21:22 -05:00
parent 1a59c3d33a
commit b3c5722a80
6 changed files with 64 additions and 15 deletions

Binary file not shown.

View File

@ -1,6 +1,6 @@
name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.6.0
version: 3.6.1
commands:
money:
description: Tells the player the amount of money they are holding.

View File

@ -2392,7 +2392,7 @@ public class GenericFunctions {
item.setItemMeta(m);
return item;
} else {
String newname = name+" "+ChatColor.GREEN+"\\("+CapitalizeFirstLetters(getBowMode(item).name())+" Mode)"+ChatColor.WHITE;
String newname = name+" "+ChatColor.GREEN+"("+CapitalizeFirstLetters(getBowMode(item).name())+" Mode)"+ChatColor.WHITE;
m.setDisplayName(newname);
item.setItemMeta(m);
return item;

View File

@ -62,6 +62,8 @@ public class PlayerStructure {
public double highwinderdmg=0.0;
public int nextarrowxp = 0; //How much bonus XP to give to an Artifact Bow.
public boolean hasfullrangerset=false;
public double lastarrowpower=0;
public int headshotcombo=0;
public double prev_weapondmg=0.0;
public double prev_buffdmg=0.0;

View File

@ -497,11 +497,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
/*
if (GenericFunctions.isRanger(p) &&
GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) {
p.removePotionEffect(PotionEffectType.SLOW);
p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,20,5));
}
}*/
if (TwosideShops.PlayerHasPurchases(p)) {
TwosideShops.PlayerSendPurchases(p);
@ -1120,7 +1121,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
@Override
public void run() {
if (Bukkit.getOnlinePlayers().size()==1 && restarting_server) {
if (Bukkit.getOnlinePlayers().size()==0 && restarting_server) {
Bukkit.savePlayers();
DiscordMessageSender.sendItalicizedRawMessageDiscord("All players have disconnected. Server is shutting down...");
for (int i=0;i<Bukkit.getWorlds().size();i++) {
@ -1751,7 +1752,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
BowMode mode = GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand());
switch (mode) {
case CLOSE:{
p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,20,5));
p.playSound(p.getLocation(), Sound.ENTITY_ZOMBIE_INFECT, 0.5f, 0.1f);
GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(),BowMode.SNIPE);
}break;
@ -4136,16 +4136,26 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (GenericFunctions.isRanger(p)) {
if (p.getLocation().distanceSquared(m.getLocation())>=64 || GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.CLOSE) {
headshotvalx*=4;
headshotvaly*=6;
headshotvaly*=4;
headshotvalz*=4;
}
if (GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) {
headshotvalx*=3;
headshotvaly*=12;
headshotvaly*=3;
headshotvalz*=3;
}
}
//Get the headshot multiplier based on arrow power.
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
double mult=1d;
mult = (GenericFunctions.isRanger(p))?(pd.lastarrowpower/140d):(pd.lastarrowpower/9d);
ev.setDamage(ev.getDamage()*mult);
headshotvalx*=mult;
headshotvaly*=mult;
headshotvalz*=mult;
log("Headshot hitbox size Multiplier: x"+mult,2);
log(headshotvalx+","+headshotvaly+","+headshotvalz,5);
if (ev.getDamager().getTicksLived()>=4 || GenericFunctions.isRanger(p)) {
@ -4154,9 +4164,34 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Math.abs(arrowLoc.getX()-monsterHead.getX())<=headshotvalx) {
if (GenericFunctions.isRanger(p) && GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) {
ev.setDamage(ev.getDamage()*4.0);
p.sendMessage(ChatColor.DARK_RED+"Headshot! x4 Damage");
p.playSound(p.getLocation(), Sound.ENTITY_LIGHTNING_IMPACT, 0.2f, 0.24f);
if (pd.headshotcombo<8) {pd.headshotcombo++;}
ev.setDamage(ev.getDamage()*(2+(pd.headshotcombo*0.25)));
p.sendMessage(ChatColor.DARK_RED+"Headshot! x"+(2+(pd.headshotcombo*0.25))+" Damage");
if (p.hasPotionEffect(PotionEffectType.SLOW)) {
//Add to the current stack of BLINDNESS.
for (int i1=0;i1<p.getActivePotionEffects().size();i1++) {
if (Iterables.get(p.getActivePotionEffects(), i1).getType().equals(PotionEffectType.SLOW)) {
int lv = Iterables.get(p.getActivePotionEffects(), i1).getAmplifier();
log("New Slowness level: "+lv,2);
p.removePotionEffect(PotionEffectType.SLOW);
p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,99,lv+1));
break;
}
}
} else {
p.removePotionEffect(PotionEffectType.SLOW);
p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,99,0));
}
final Player pl = p;
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
if (pl!=null && pl.isOnline() && !pl.hasPotionEffect(PotionEffectType.SLOW)) {
PlayerStructure pd = (PlayerStructure)playerdata.get(pl.getUniqueId());
pd.headshotcombo=0;
}
}}
,100);
p.playSound(p.getLocation(), Sound.ENTITY_LIGHTNING_IMPACT, 0.1f, 0.24f);
} else {
ev.setDamage(ev.getDamage()*2.0);
p.sendMessage(ChatColor.DARK_RED+"Headshot! x2 Damage");
@ -4206,7 +4241,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) &&
GenericFunctions.isArtifactWeapon(p.getEquipment().getItemInMainHand())) {
log("EXP ratio is "+ratio,5);
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
pd.nextarrowxp+=(int)(ratio*20)+5+(headshot?10:0);
}
@ -4219,7 +4253,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
//Make this monster the player's new target.
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
//Found the player structure. Set the target.
pd.target=m;
updateTitle(p,headshot);
@ -4486,8 +4519,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
GenericFunctions.breakHardenedItem(item,p);
} else
{
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0f, 1.0f);
p.sendMessage(ChatColor.DARK_RED+"Your "+ChatColor.YELLOW+((item.hasItemMeta() && item.getItemMeta().hasDisplayName())?item.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(item))+ChatColor.DARK_RED+" has broken!");
breakdownItem(item,p);
}
}
@ -4883,8 +4915,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Player p = (Player)arr.getShooter();
if (GenericFunctions.isRanger(p)) {
arr.setVelocity(arr.getVelocity().multiply(4));
if (GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) {
aPlugin.API.damageItem(p, p.getEquipment().getItemInMainHand(), 3);
//p.getEquipment().getItemInMainHand().setDurability((short)(p.getEquipment().getItemInMainHand().getDurability()+1));
}
//p.getWorld().spawnArrow(arr.getLocation(), arr.getLocation().getDirection(), 20, 1);
}
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
pd.lastarrowpower=arr.getVelocity().lengthSquared();
log("Arrow velocity is "+arr.getVelocity().lengthSquared(),4);
}
}
}
@ -6684,4 +6723,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
DiscordMessageSender.sendItalicizedRawMessageDiscord(SERVER_TYPE.GetServerName()+"Server has been restarted.\nRunning v."+Bukkit.getPluginManager().getPlugin("TwosideKeeper").getDescription().getVersion()+" of TwosideKeeper\nRunning v"+Bukkit.getPluginManager().getPlugin("aPlugin").getDescription().getVersion()+" of Jobs.");
}
}
public static void breakdownItem(ItemStack item, Player p) {
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0f, 1.0f);
p.sendMessage(ChatColor.DARK_RED+"Your "+ChatColor.YELLOW+((item.hasItemMeta() && item.getItemMeta().hasDisplayName())?item.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(item))+ChatColor.DARK_RED+" has broken!");
}
}

View File

@ -148,6 +148,9 @@ public final class TwosideKeeperAPI {
public static void playMessageNotification(Player sender) {
TwosideKeeper.playMessageNotification(sender);
}
public static void notifyBrokenItemToPlayer(ItemStack item, Player p) {
TwosideKeeper.breakdownItem(item,p);
}
//Spleef COMMANDS.
public static boolean isPlayingSpleef(Player p) {