->During thunderstorms, mobs will have a normal spawn rate, even on the

surface.
->Basic item decomposition has been removed. Transmutation through
Alchemy is the preferred method to decompose materials now.
->Zombie minion damage slightly nerfed.
->You know how I said Anvil renaming was really fixed, like really, and
I meant it? Well, I now I really mean it for the last time. Really.
->Ranger Close Mode receieves modifications:
---> Rangers that kill a mob in Close Range mode will obtain a "Full
Dodge" buff. This buff lasts until the player takes damage from any
damage source. The buff provides 100% dodge chance.
---> Rangers can now tumble by holding shift and left-clicking to gain 1
second of invincibility and a speed buff. Rangers who have a full set
will gain 3 seconds of invincibility from this ability.
This commit is contained in:
sigonasr2 2016-07-18 18:12:21 -05:00
parent 2f0304f9f1
commit ca2b7c8a79
7 changed files with 148 additions and 31 deletions

Binary file not shown.

View File

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

View File

@ -0,0 +1,52 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import sig.plugin.TwosideKeeper.TwosideKeeper;
public class AnvilItem {
ItemStack olditem;
ItemStack newitem;
public AnvilItem(ItemStack olditem, ItemStack newitem) {
this.olditem=olditem;
this.newitem=newitem;
}
public static boolean validitem(ItemStack item) {
return (item!=null && item.getType()!=Material.AIR &&
item.hasItemMeta() && item.getItemMeta().hasDisplayName());
}
public String getColorCodes() {
ItemMeta m = olditem.getItemMeta();
return m.getDisplayName().replace(ChatColor.stripColor(m.getDisplayName()), "");
}
public ItemStack renameItemProperly() {
if (validitem(olditem) && validitem(newitem)) {
//Input Item : ᶲ2+Test New Item: 2Jelly
String var = getColorCodes(); //var = ChatColor.RED (ᶲ2)
TwosideKeeper.log("var = "+var, 2);
String newcol = newitem.getItemMeta().getDisplayName(); //2Jelly
String colors = "";
if (var.length()>=2) {
colors = var.replace(ChatColor.COLOR_CHAR+"", ""); //2
}
if (newcol.indexOf(colors)==0) {
//See if the new name starts with the color codes.
ItemMeta m = newitem.getItemMeta();
m.setDisplayName(newcol.replace(colors, var)); //ᶲ2+jelly
newitem.setItemMeta(m);
return newitem;
}
}
return newitem;
}
}

View File

@ -2377,6 +2377,9 @@ public class GenericFunctions {
if (isRanger(p)) { if (isRanger(p)) {
dodgechance+=0.5; dodgechance+=0.5;
} }
if (pd.fulldodge) {
dodgechance = 1.0;
}
return dodgechance; return dodgechance;
} }

View File

@ -37,13 +37,19 @@ public class MonsterController {
* @return Returns false if this spawn is not allowed. * @return Returns false if this spawn is not allowed.
*/ */
public static boolean MobHeightControl(LivingEntity ent, boolean minion) { public static boolean MobHeightControl(LivingEntity ent, boolean minion) {
if (ent instanceof Monster) {
Monster m = (Monster)ent;
m.setAI(true);
}
//Modify spawning algorithm. //Modify spawning algorithm.
int ylv = ent.getLocation().getBlockY(); int ylv = ent.getLocation().getBlockY();
if (minion) { if (minion) {
ylv+=16; ylv+=16;
ent.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,999999,1)); ent.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,999999,1));
ent.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,1)); ent.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,0));
ent.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,999999,4)); ent.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,999999,3));
ent.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,999999,4)); ent.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,999999,4));
} }
if (isZombieLeader(ent)) { if (isZombieLeader(ent)) {

View File

@ -14,6 +14,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -64,6 +65,10 @@ public class PlayerStructure {
public boolean hasfullrangerset=false; public boolean hasfullrangerset=false;
public double lastarrowpower=0; public double lastarrowpower=0;
public int headshotcombo=0; public int headshotcombo=0;
public List<InventoryView> itemcubeviews;
public boolean openinginventory=false;
public boolean fulldodge=false;
public long last_dodge=TwosideKeeper.getServerTickTime();
public double prev_weapondmg=0.0; public double prev_weapondmg=0.0;
public double prev_buffdmg=0.0; public double prev_buffdmg=0.0;
@ -105,6 +110,10 @@ public class PlayerStructure {
this.nextarrowxp=0; this.nextarrowxp=0;
this.hasfullrangerset=false; this.hasfullrangerset=false;
this.last_strikerspell=TwosideKeeper.getServerTickTime(); this.last_strikerspell=TwosideKeeper.getServerTickTime();
this.itemcubeviews = new ArrayList<InventoryView>();
this.openinginventory = false;
this.fulldodge=false;
this.last_dodge=TwosideKeeper.getServerTickTime();
//Set defaults first, in case this is a new user. //Set defaults first, in case this is a new user.
loadConfig(); loadConfig();

View File

@ -158,6 +158,7 @@ import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import net.minecraft.server.v1_9_R1.MinecraftServer; import net.minecraft.server.v1_9_R1.MinecraftServer;
import net.minecraft.server.v1_9_R1.Vector3f; import net.minecraft.server.v1_9_R1.Vector3f;
import sig.plugin.TwosideKeeper.HelperStructures.AnvilItem;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType;
@ -269,7 +270,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
sig.plugin.TwosideKeeper.Recipes.Initialize_ItemCube_Recipes(); sig.plugin.TwosideKeeper.Recipes.Initialize_ItemCube_Recipes();
sig.plugin.TwosideKeeper.Recipes.Initialize_ArrowQuiver_Recipe(); sig.plugin.TwosideKeeper.Recipes.Initialize_ArrowQuiver_Recipe();
sig.plugin.TwosideKeeper.Recipes.Initialize_BlockArmor_Recipes(); sig.plugin.TwosideKeeper.Recipes.Initialize_BlockArmor_Recipes();
sig.plugin.TwosideKeeper.Recipes.Initialize_ItemDeconstruction_Recipes(); //sig.plugin.TwosideKeeper.Recipes.Initialize_ItemDeconstruction_Recipes();
sig.plugin.TwosideKeeper.Recipes.Initialize_WoolRecolor_Recipes(); sig.plugin.TwosideKeeper.Recipes.Initialize_WoolRecolor_Recipes();
sig.plugin.TwosideKeeper.Recipes.Initialize_SlabReconstruction_Recipes(); sig.plugin.TwosideKeeper.Recipes.Initialize_SlabReconstruction_Recipes();
sig.plugin.TwosideKeeper.Recipes.Initialize_Artifact_Recipes(); sig.plugin.TwosideKeeper.Recipes.Initialize_Artifact_Recipes();
@ -826,6 +827,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
p.getLocation().add(0,0,0).getBlock().setType(Material.AIR); p.getLocation().add(0,0,0).getBlock().setType(Material.AIR);
} }
if (SERVER_TYPE==ServerType.TEST || SERVER_TYPE==ServerType.QUIET) { if (SERVER_TYPE==ServerType.TEST || SERVER_TYPE==ServerType.QUIET) {
TwosideKeeperAPI.spawnAdjustedMonster(MonsterType.GIANT, p.getLocation());
//GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(), BowMode.SNIPE); //GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(), BowMode.SNIPE);
//p.sendMessage("This is bow mode "+GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())); //p.sendMessage("This is bow mode "+GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand()));
/*for (int i=0;i<p.getEquipment().getArmorContents().length;i++) { /*for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
@ -1797,6 +1799,31 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
//Check for a roll attempt here.
if ((ev.getAction()==Action.LEFT_CLICK_AIR || ev.getAction()==Action.LEFT_CLICK_BLOCK)) {
Player p = ev.getPlayer();
if (p.isSneaking() && p.isOnGround() && GenericFunctions.isRanger(p) &&
GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.CLOSE) {
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
if (pd.last_dodge+100<=getServerTickTime()) {
pd.last_dodge=getServerTickTime();
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), 100);
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), 100);
p.playSound(p.getLocation(), Sound.ENTITY_DONKEY_CHEST, 1.0f, 1.0f);
int dodgeduration = 20;
if (GenericFunctions.HasFullRangerSet(p)) {
dodgeduration=60;
}
p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION,dodgeduration,0));
p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,dodgeduration,2));
p.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING,dodgeduration,0));
}
}
}
//Check for a Scythe right click here. //Check for a Scythe right click here.
if ((ev.getAction()==Action.RIGHT_CLICK_AIR || ev.getAction()==Action.RIGHT_CLICK_BLOCK) && if ((ev.getAction()==Action.RIGHT_CLICK_AIR || ev.getAction()==Action.RIGHT_CLICK_BLOCK) &&
GenericFunctions.isArtifactEquip(player.getEquipment().getItemInMainHand())) { GenericFunctions.isArtifactEquip(player.getEquipment().getItemInMainHand())) {
@ -2789,6 +2816,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.getResult().setItemMeta(m); ev.getResult().setItemMeta(m);
ev.setResult(ev.getResult()); ev.setResult(ev.getResult());
} else { } else {
AnvilItem item = new AnvilItem(ev.getInventory().getItem(0),ev.getResult());
ev.setResult(item.renameItemProperly());
/*if (ev.getResult()!=null && /*if (ev.getResult()!=null &&
ev.getInventory().getItem(0)!=null && ev.getInventory().getItem(0)!=null &&
ev.getInventory().getItem(0).getItemMeta().hasDisplayName()) { ev.getInventory().getItem(0).getItemMeta().hasDisplayName()) {
@ -3192,6 +3221,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (!ItemCube.isSomeoneViewingItemCube(idnumb,p)) { if (!ItemCube.isSomeoneViewingItemCube(idnumb,p)) {
ev.setCancelled(true); ev.setCancelled(true);
ev.setResult(Result.DENY); ev.setResult(Result.DENY);
//pd.itemcubeviews.add(p.getOpenInventory());
InventoryView newinv = p.openInventory(Bukkit.getServer().createInventory(p, inventory_size, "Item Cube #"+idnumb)); InventoryView newinv = p.openInventory(Bukkit.getServer().createInventory(p, inventory_size, "Item Cube #"+idnumb));
openItemCubeInventory(newinv.getTopInventory(),newinv); openItemCubeInventory(newinv.getTopInventory(),newinv);
pd.isViewingItemCube=true; pd.isViewingItemCube=true;
@ -3200,6 +3230,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.setCancelled(true); ev.setCancelled(true);
ev.setResult(Result.DENY); ev.setResult(Result.DENY);
//ItemCube.displayErrorMessage(p); //ItemCube.displayErrorMessage(p);
//pd.itemcubeviews.add(p.getOpenInventory());
p.openInventory(ItemCube.getViewingItemCubeInventory(idnumb, p)); p.openInventory(ItemCube.getViewingItemCubeInventory(idnumb, p));
pd.isViewingItemCube=true; pd.isViewingItemCube=true;
p.playSound(p.getLocation(), Sound.BLOCK_CHEST_OPEN, 1.0f, 1.0f); p.playSound(p.getLocation(), Sound.BLOCK_CHEST_OPEN, 1.0f, 1.0f);
@ -3533,6 +3564,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
//If glowing, the player is invulnerable.
if (p.hasPotionEffect(PotionEffectType.GLOWING)) {
p.setNoDamageTicks(20);
ev.setCancelled(true);
} else {
//Dodge should not activate when we have invincibility frames.
//final double pcthp = ((p.getHealth())/p.getMaxHealth())*100; //final double pcthp = ((p.getHealth())/p.getMaxHealth())*100;
double dodgechance = GenericFunctions.CalculateDodgeChance(p); double dodgechance = GenericFunctions.CalculateDodgeChance(p);
@ -3542,6 +3580,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
dodgechance=1; dodgechance=1;
} }
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
if (pd.fulldodge) {
pd.fulldodge=false;
}
if (Math.random()<=dodgechance) { if (Math.random()<=dodgechance) {
//Cancel this event, we dodged the attack. //Cancel this event, we dodged the attack.
p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f); p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f);
@ -3557,14 +3601,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
ev.setCancelled(true); ev.setCancelled(true);
}
//If glowing, the player is invulnerable.
if (p.hasPotionEffect(PotionEffectType.GLOWING)) {
p.setNoDamageTicks(20);
ev.setCancelled(true);
} }
log("Dodge chance is "+dodgechance,5); log("Dodge chance is "+dodgechance,5);
}
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() { public void run() {
if (p!=null) { if (p!=null) {
@ -4313,6 +4354,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId()); PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
if (GenericFunctions.isRanger(p) &&
GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.CLOSE) {
pd.fulldodge=true;
}
dropmult+=pd.partybonus*0.33; //Party bonus increases drop rate by 33% per party member. dropmult+=pd.partybonus*0.33; //Party bonus increases drop rate by 33% per party member.
ItemStack item = p.getEquipment().getItemInMainHand(); ItemStack item = p.getEquipment().getItemInMainHand();
if (item!=null && if (item!=null &&