Updates to PVP, team PVP clarity, bugfixes, balance changes.

patch_branch
sigonasr2 8 years ago
parent 15e872803f
commit 7a87c6ce4f
  1. BIN
      TwosideKeeper.jar
  2. 2
      src/plugin.yml
  3. 19
      src/sig/plugin/TwosideKeeper/CustomDamage.java
  4. 14
      src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java
  5. 8
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
  6. 43
      src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java
  7. 197
      src/sig/plugin/TwosideKeeper/PVP.java
  8. 2
      src/sig/plugin/TwosideKeeper/PlayerStructure.java
  9. 32
      src/sig/plugin/TwosideKeeper/TwosideKeeper.java
  10. 6
      src/sig/plugin/TwosideKeeper/runServerHeartbeat.java

Binary file not shown.

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

@ -739,8 +739,8 @@ public class CustomDamage {
}
if (getDamagerEntity(damager) instanceof Enderman) {
if (MonsterController.getMonsterDifficulty(((Monster)getDamagerEntity(damager)))==MonsterDifficulty.HELLFIRE) {
for (int i=0;i<4;i++) {
if (Math.random()<=0.2) {
for (int i=0;i<4;i++) {
if (Math.random()<=0.2) {
LivingEntity mm = MonsterController.spawnAdjustedMonster(MonsterType.ENDERMITE, getDamagerEntity(damager).getLocation().add(0,1,0));
mm.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,Integer.MAX_VALUE,2));
}
@ -2796,6 +2796,13 @@ public class CustomDamage {
case CHAINMAIL_LEGGINGS:
case CHAINMAIL_CHESTPLATE:
case CHAINMAIL_HELMET: {
if (target instanceof Player) {
Player p = (Player)target;
if (PVP.isPvPing(p)) {
dmgreduction+=10*((isBlockArmor)?2:1);
break;
}
}
dmgreduction+=6*((isBlockArmor)?2:1);
}break;
case IRON_BOOTS:
@ -3276,7 +3283,11 @@ public class CustomDamage {
LivingEntity shooter = getDamagerEntity(damager);
if (shooter instanceof Player) {
if (PlayerMode.isRanger((Player)shooter)) {
return 4.0;
if (PVP.isPvPing((Player)shooter)) {
return 0.0;
} else {
return 3.0;
}
}
}
return 0.0;
@ -4191,7 +4202,7 @@ public class CustomDamage {
mult+=2.0;
}
if (PVP.isPvPing((Player)shooter)) {
mult /= 4.0;
mult /= 3.0;
}
if (ItemSet.meetsSlayerSwordConditions(ItemSet.ASSASSIN, 18, 2, (Player)shooter)) {
Material name = ((Player)shooter).getEquipment().getItemInMainHand().getType();

@ -30,7 +30,7 @@ public enum ArtifactAbility {
//Weapon Abilities
DAMAGE("Strike","Improves Base Damage by [VAL]",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new PVPValue(30,1.0),10000,1,UpgradePath.BASIC,1),
new PVPValue(15,1.0),10000,1,UpgradePath.BASIC,1),
ARMOR_PEN("Piercing","[VAL]% of your damage is ignored by resistances. ([PENDMG] damage)",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new PVPValue(30,1.0),100,1,UpgradePath.BASIC,1),
EXECUTION("Execute","Deals [VAL] extra damage for every 20% of target's missing health.",new double[]{0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3},
@ -59,9 +59,9 @@ public enum ArtifactAbility {
//Armor abilities
DAMAGE_REDUCTION("Defense","Increases Base Damage reduction by [VAL]%\n\n"+PlayerMode.RANGER.getColor()+PlayerMode.RANGER.getName()+" Mode "+ChatColor.WHITE+" only receives half the effect.",new double[]{0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245},
new PVPValue(80,0.245),100,1,UpgradePath.ARMOR,1),
new PVPValue(50,0.245),100,1,UpgradePath.ARMOR,1),
HEALTH("Health","Increases Maximum Health by [VAL].\n\n"+PlayerMode.RANGER.getColor()+PlayerMode.RANGER.getName()+" Mode "+ChatColor.WHITE+" only receives half the effect.",new double[]{0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25},
new PVPValue(40,0.25),10000,1,UpgradePath.ARMOR,1),
new PVPValue(30,0.25),10000,1,UpgradePath.ARMOR,1),
HEALTH_REGEN("Regeneration","Regenerates an extra [VAL] health every 5 seconds.",new double[]{0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125},
new PVPValue(1,0.125),10000,1,UpgradePath.ARMOR,1),
STATUS_EFFECT_RESISTANCE("Resistance","When a debuff is applied, there is a [VAL]% chance to remove it.",new double[]{0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25},
@ -100,9 +100,9 @@ public enum ArtifactAbility {
+ "Suppression prevents movement, attacking, exploding, and teleportation."+LevelCost(10),new double[]{0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02},
new PVPValue(10,0.02),100,10,UpgradePath.SHOVEL,10),
ERUPTION("Eruption","Sneak while Left-clicking a mob to damage mobs for [ERUPTIONVAL] damage and knock them up. The eruption also destroys the ground beneath you.",new double[]{3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0},
new PVPValue(30,3.0),10000,40,UpgradePath.SHOVEL,1),
new PVPValue(15,3.0),10000,40,UpgradePath.SHOVEL,1),
EARTHWAVE("Earth Wave","While in mid-air, right-click to instantly slam into the ground and launch soft blocks. This attack ignores fall damage. The larger the fall, the larger the wave.\n\nDeals [EARTHWAVEVAL] damage to every enemy hit by the wave. Deals double damage and knocks up on soft blocks.",new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},
new PVPValue(30,2.0),10000,100,UpgradePath.SHOVEL,1),
new PVPValue(15,2.0),10000,100,UpgradePath.SHOVEL,1),
//Axe abilities
/*BREAKDOWN("Break Down",ChatColor.GRAY+"[Unimplemented] Breaks down armor on mobs. Each hit has a [VAL]% chance to remove a piece of armor from a mob.",new double[]{3,3,3,3,3,3,3,3,3,3},
@ -124,9 +124,9 @@ public enum ArtifactAbility {
//Scythe abilities
AOE("Area of Effect","Deals damage to targets up to [AOEVAL]m from the main target hit.",new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},
new PVPValue(3,1.0),10000,1,UpgradePath.SCYTHE,1),
new PVPValue(5,1.0),10000,1,UpgradePath.SCYTHE,1),
DEATHMARK("Death Mark","Applies a Death Mark stack to enemies hit. Death mark stacks last for 5 seconds, and refresh on each hit.\n\nMarks can be detonated at any time by right-clicking. Targets killed with Death Mark resets the cooldown. Targets not killed lose half their Death Mark stacks.\n\n Each death mark stack applied deals [VAL] true damage.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new PVPValue(3,1.0),10000,10,UpgradePath.SCYTHE,1),
new PVPValue(10,1.0),10000,10,UpgradePath.SCYTHE,1),
CRIPPLE("Cripple","Every 10 death marks applied on a monster increases damage dealt from all damage sources by [VAL]%.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new PVPValue(1,1.0),100,1000,UpgradePath.SCYTHE,1),

@ -134,7 +134,6 @@ public class GenericFunctions {
}
public static ItemStack breakHardenedItem(ItemStack item, Player p) {
showStackTrace();
int break_count = getHardenedItemBreaks(item);
if (break_count>0) {
@ -2253,6 +2252,11 @@ public class GenericFunctions {
leather=false;
break;
}
ItemSet set = ItemSet.GetItemSet(equip);
if (!ItemSet.isRangerSet(set) && !GenericFunctions.isArtifactArmor(equip)) {
leather=false;
break;
}
}
return leather;
}
@ -3728,6 +3732,8 @@ public class GenericFunctions {
if (!revived) {
if (PVP.isPvPing(p)) {
revived=true;
pd.lastPVPHitReason = reason;
pd.lastPVPHitDamage = dmg;
RevivePlayer(p, p.getMaxHealth());
PVP session = PVP.getMatch(p);
session.onDeathEvent(p);

@ -87,6 +87,17 @@ public enum ItemSet {
//ItemSet.SHARD,
//ItemSet.TOXIN,
};
public static final ItemSet[] SLAYER= new ItemSet[]{
ItemSet.ASSASSIN,
ItemSet.LORASYS,
ItemSet.STEALTH,
};
public static final ItemSet[] RANGER2 = new ItemSet[]{
ItemSet.SHARD,
ItemSet.TOXIN,
};
public static final ItemSet[] MELEE = new ItemSet[]{
ItemSet.DAWNTRACKER,
ItemSet.PANROS,
@ -1236,17 +1247,39 @@ public enum ItemSet {
}
public static boolean isTrinketSet(ItemSet is) {
for (ItemSet tr : TRINKET) {
if (is == tr) {
return true;
if (is!=null) {
for (ItemSet tr : TRINKET) {
if (is == tr) {
return true;
}
}
}
return false;
}
public static boolean isAssassinSet(ItemSet is) {
if (is == ItemSet.ASSASSIN || is == ItemSet.LORASYS || is == ItemSet.STEALTH) {
return true;
if (is!=null) {
for (ItemSet set : SLAYER) {
if (is==set) {
return true;
}
}
}
return false;
}
public static boolean isRangerSet(ItemSet is) {
if (is!=null) {
for (ItemSet set : RANGER) {
if (is==set) {
return true;
}
}
for (ItemSet set : RANGER2) {
if (is==set) {
return true;
}
}
}
return false;
}

@ -10,16 +10,22 @@ import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Chunk;
import org.bukkit.ChunkSnapshot;
import org.bukkit.Color;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarFlag;
import org.bukkit.boss.BarStyle;
import org.bukkit.boss.BossBar;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionEffect;
import com.google.common.collect.ImmutableList;
@ -167,6 +173,78 @@ public class PVP {
for (int i=9;i<36;i++) {
p.getInventory().setItem(i, new ItemStack(Material.AIR));
}
ReplaceGearWithLeatherVersionAndFilterItems(p);
}
private void ReplaceGearWithLeatherVersionAndFilterItems(Player p) {
for (int i=0;i<p.getInventory().getSize();i++) {
ItemStack item = p.getInventory().getItem(i);
if (ItemUtils.isValidItem(item) &&
GenericFunctions.isArmor(item)) {
String[] split = item.getType().name().split("_");
if (split.length==2) {
Material newtype = Material.valueOf("LEATHER_"+split[1]);
ItemStack newitem = new ItemStack(newtype);
newitem.setItemMeta(item.getItemMeta());
newitem = GenericFunctions.addHardenedItemBreaks(newitem, 100).clone();
p.getInventory().setItem(i, newitem);
}
}
if (ItemUtils.isValidItem(item) &&
item.hasItemMeta() && item.getItemMeta() instanceof PotionMeta) {
PotionMeta meta = (PotionMeta)item.getItemMeta();
for (PotionEffect pe : meta.getCustomEffects()) {
if (pe.getAmplifier()>4) { //This potion is too strong, and cannot be used in a PvP match.
p.getInventory().setItem(i, new ItemStack(Material.AIR));
}
}
}
//Use of scrolls should also be forbidden.
if (ItemUtils.isValidItem(item) &&
item.getType()==Material.PAPER &&
item.hasItemMeta() && item.getEnchantments().size()>0) {
//This means it's magical paper and is not allowed.
p.getInventory().setItem(i, new ItemStack(Material.AIR));
}
}
RemoveAllPlayerBuffs(p);
}
private void RemoveAllPlayerBuffs(Player p) {
for (PotionEffect pe : p.getActivePotionEffects()) {
GenericFunctions.logAndRemovePotionEffectFromEntity(pe.getType(), p);
}
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.vendetta_amt=0;
pd.weaponcharges=0;
pd.damagepool=0;
HashMap<String,Buff> buffs = Buff.getBuffData(p);
for (String s : buffs.keySet()) {
Buff b = buffs.get(s);
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
b.removeBuff(p, s);
}, 1);
}
}
private void ColorGearBasedOnTeam(Player p, int team) {
for (int i=0;i<p.getInventory().getSize();i++) {
ItemStack item = p.getInventory().getItem(i);
if (ItemUtils.isValidItem(item) &&
GenericFunctions.isArmor(item) &&
item.getType().name().startsWith("LEATHER_")) {
Color col = Bukkit.getServer().getItemFactory().getDefaultLeatherColor();
if (team==1) {
col = Color.fromRGB(66, 134, 244);
} else {
col = Color.fromRGB(244, 65, 65);
}
LeatherArmorMeta meta = (LeatherArmorMeta)item.getItemMeta();
meta.setColor(col);
item.setItemMeta(meta);
p.getInventory().setItem(i, item);
}
}
}
private void leaveMatch(String s) {
@ -175,6 +253,11 @@ public class PVP {
Player p = Bukkit.getPlayer(s);
if (p!=null && p.isOnline()) {
p.sendMessage(ChatColor.YELLOW+s+" has left the match.");
PVPPlayer pp = players.get(p.getName());
for (int i=0;i<p.getInventory().getSize();i++) {
p.getInventory().setItem(i, pp.original_inv.getItem(i));
}
RemoveAllPlayerBuffs(p);
}
players.remove(s);
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin,()->{
@ -183,6 +266,7 @@ public class PVP {
if (pl!=null && pl.isValid() && pl.isOnline() && !s.equalsIgnoreCase(ss)) {
pl.sendMessage(ChatColor.YELLOW+s+" has left the match. Current Participants: "+ChatColor.YELLOW+getParticipants());
}
RemoveAllPlayerBuffs(pl);
}
},2);
}
@ -240,13 +324,7 @@ public class PVP {
resetPlayerChoices();
DisplayRoundChoices();
} else {
for (String s : players.keySet()) {
Player pl = Bukkit.getPlayer(s);
if (pl!=null && pl.isValid() && pl.isOnline()) {
pl.sendMessage(ChatColor.YELLOW+"Not enough participants!"+ChatColor.GREEN+" The PVP Match has been disbanded.");
}
}
return false; //Cancelled.
return DisbandMatch(ChatColor.YELLOW+"Not enough participants!"+ChatColor.GREEN+" The PVP Match has been disbanded.");
}
}
//}
@ -277,7 +355,7 @@ public class PVP {
p.sendMessage(ChatColor.YELLOW+style.getTitle()+ChatColor.GREEN+" has been voted as the style for this PVP match!");
}
}
if (players.size()>=2 && style.name().contains("ROUNDS")) {
if (players.size()>2 && style.name().contains("ROUNDS")) {
state = CHOICEENGINE.WAITFORTEAMCHOICES;
isTeamMatch=true;
lastSelected=TwosideKeeper.getServerTickTime();
@ -290,13 +368,7 @@ public class PVP {
}
timer=TwosideKeeper.getServerTickTime();
} else {
for (String s : players.keySet()) {
Player pl = Bukkit.getPlayer(s);
if (pl!=null && pl.isValid() && pl.isOnline()) {
pl.sendMessage(ChatColor.YELLOW+"Not enough participants!"+ChatColor.GREEN+" The PVP Match has been disbanded.");
}
}
return false; //Cancelled.
return DisbandMatch(ChatColor.YELLOW+"Not enough participants!"+ChatColor.GREEN+" The PVP Match has been disbanded.");
}
}
}break;
@ -305,13 +377,7 @@ public class PVP {
if (allPlayersHaveChosenATeam() || lastSelected+4000<=TwosideKeeper.getServerTickTime()) {
randomlyPickTeams();
if (teamsAreInvalid()) {
for (String s : players.keySet()) {
Player p = Bukkit.getPlayer(s);
if (p!=null) {
p.sendMessage("Not enough players in both teams to begin a PvP Match! The match has been cancelled.");
}
}
return false;
return DisbandMatch("Not enough players in both teams to begin a PvP Match! The match has been cancelled.");
}
SendTeamList();
resetPlayerChoices();
@ -367,13 +433,7 @@ public class PVP {
}
}
} else {
for (String s : players.keySet()) {
Player pl = Bukkit.getPlayer(s);
if (pl!=null && pl.isValid() && pl.isOnline()) {
pl.sendMessage(ChatColor.YELLOW+"Not enough participants!"+ChatColor.GREEN+" The PVP Match has been disbanded.");
}
}
return false; //Cancelled.
return DisbandMatch(ChatColor.YELLOW+"Not enough participants!"+ChatColor.GREEN+" The PVP Match has been disbanded.");
}
}
}break;
@ -416,6 +476,18 @@ public class PVP {
return true;
}
private boolean DisbandMatch(String msg) {
giveBackInventories();
for (String s : players.keySet()) {
Player pl = Bukkit.getPlayer(s);
if (pl!=null && pl.isValid() && pl.isOnline()) {
pl.sendMessage(msg);
}
}
return false; //Cancelled.
}
private void giveBackInventories() {
for (String s : players.keySet()) {
PVPPlayer pp = players.get(s);
@ -424,6 +496,10 @@ public class PVP {
for (int i=0;i<p.getInventory().getSize();i++) {
p.getInventory().setItem(i, pp.original_inv.getItem(i));
}
InventoryView view = p.getOpenInventory();
if (view!=null) {
view.setCursor(new ItemStack(Material.AIR));
}
}
}
}
@ -551,6 +627,7 @@ public class PVP {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
p.setHealth(p.getMaxHealth());
p.sendMessage(sb.toString());
RemoveAllPlayerBuffs(p);
pd.customtitle.modifySmallCenterTitle(ChatColor.GREEN+"Next match starting...", 100);
for (int i=0;i<5;i++) {
final int counter = i;
@ -722,11 +799,15 @@ public class PVP {
Bukkit.getPlayer(s).setGameMode(GameMode.SURVIVAL);
Player p = Bukkit.getPlayer(s);
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
TwosideKeeper.setPlayerMaxHealth(p, p.getHealth()/p.getMaxHealth(), true);
p.teleport(pd.locBeforeInstance);
pd.lastplayerHitBy=null;
pd.locBeforeInstance=null;
GenericFunctions.RevivePlayer(p, p.getMaxHealth());
if (p!=null && p.isOnline()) {
TwosideKeeper.setPlayerMaxHealth(p, p.getHealth()/p.getMaxHealth(), true);
if (pd.locBeforeInstance!=null) {
p.teleport(pd.locBeforeInstance);
}
pd.lastplayerHitBy=null;
pd.locBeforeInstance=null;
GenericFunctions.RevivePlayer(p, p.getMaxHealth());
}
}
}, 5);
}
@ -979,17 +1060,17 @@ public class PVP {
}
}
private void removeInactivePlayers() {
public void removeInactivePlayers() {
String removedPlayer = null;
for (String s : players.keySet()) {
Player p = Bukkit.getPlayer(s);
if (p==null || !p.isOnline()) {
PVPPlayer pp = players.get(removedPlayer);
for (int i=0;i<p.getInventory().getSize();i++) {
/*for (int i=0;i<p.getInventory().getSize();i++) {
if (ItemUtils.isValidItem(pp.original_inv.getItem(i))) {
p.getInventory().setItem(i, pp.original_inv.getItem(i));
}
}
}*/
removedPlayer = s;
break;
}
@ -1233,8 +1314,10 @@ public class PVP {
sb.append("\n");
for (String s : players.keySet()) {
Player p = Bukkit.getPlayer(s);
PVPPlayer pp = players.get(s);
if (p!=null) {
p.sendMessage(sb.toString());
ColorGearBasedOnTeam(p,pp.team);
}
}
}
@ -1443,6 +1526,7 @@ public class PVP {
myself.isAlive=true;
p.setGameMode(GameMode.SURVIVAL);
Location myLoc = p.getLocation().clone();
RemoveAllPlayerBuffs(p);
//myLoc.setY(p.getLocation().getChunk().getChunkSnapshot().getHighestBlockYAt(Math.floorMod(p.getLocation().getBlockX(),16), Math.floorMod(p.getLocation().getBlockZ(),16)));
if (currentArena==null) {
p.teleport(myself.startingLoc.add(Math.random()*32-16,0,Math.random()*32-16));
@ -1467,10 +1551,45 @@ public class PVP {
p.setGameMode(GameMode.SPECTATOR);
p.setFallDistance(0.0f);
p.setSpectatorTarget(Bukkit.getPlayer(killedByPlayer));
p.sendMessage(" Killed by "+ChatColor.RED+killedByPlayer+ChatColor.RESET+".");
StringBuilder sb = new StringBuilder(" Killed by ");
StringBuilder sb2 = new StringBuilder(" Killed ");
sb.append(ChatColor.RED);
sb.append(killedByPlayer);
sb.append(ChatColor.RESET);
sb2.append(ChatColor.GREEN);
sb2.append(p.getName());
sb2.append(ChatColor.RESET);
if (pd.lastPVPHitDamage>0) {
DecimalFormat df = new DecimalFormat("0.00");
sb.append(" for ");
sb.append(ChatColor.RED);
sb.append(df.format(pd.lastPVPHitDamage));
sb.append(ChatColor.RESET);
sb.append(" damage");
sb2.append(" for ");
sb2.append(ChatColor.RED);
sb2.append(df.format(pd.lastPVPHitDamage));
sb2.append(ChatColor.RESET);
sb2.append(" damage");
}
if (pd.lastPVPHitReason!=null) {
sb.append(" (");
sb.append(pd.lastPVPHitReason);
sb.append(").");
sb2.append(" (");
sb2.append(pd.lastPVPHitReason);
sb2.append(").");
} else {
sb.append(".");
sb2.append(".");
}
p.sendMessage(sb.toString());
Player killerp = Bukkit.getPlayer(pd.lastplayerHitBy);
if (killerp!=null) {
killerp.sendMessage(" Killed "+ChatColor.GREEN+p.getName()+ChatColor.RESET+".");
killerp.sendMessage(sb2.toString());
PlayerStructure killerpd = PlayerStructure.GetPlayerStructure(killerp);
killerpd.damagepool=0;
killerpd.customtitle.update();
}
} else {
if (players.containsKey(p.getName())) {

@ -178,6 +178,8 @@ public class PlayerStructure {
public Location playerLocRef=null;
public boolean freshBlood=true;
public boolean firstPVPMatch=true;
public String lastPVPHitReason="";
public double lastPVPHitDamage=0;
/*State 1
* 1: Best of 3 Rounds
* 2: Best of 5 Rounds

@ -173,6 +173,7 @@ import org.bukkit.event.world.WorldSaveEvent;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Recipe;
import org.bukkit.inventory.ShapedRecipe;
@ -3546,12 +3547,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
PVP session = PVP.getMatch(p);
if (session!=null) {
PVPPlayer pp = session.players.get(p);
PVPPlayer pp = session.players.get(p.getName());
for (int i=0;i<p.getInventory().getSize();i++) {
if (ItemUtils.isValidItem(pp.original_inv.getItem(i))) {
p.getInventory().setItem(i, pp.original_inv.getItem(i));
}
p.getInventory().setItem(i, pp.original_inv.getItem(i));
}
InventoryView view = p.getOpenInventory();
if (view!=null) {
view.setCursor(new ItemStack(Material.AIR));
}
//session.removeInactivePlayers();
}
//Bukkit.getScheduler().scheduleSyncDelayedTask(this, new ShutdownServerForUpdate(),5);
@ -4859,7 +4863,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
return;
}
}
if (ev.getAction()==Action.RIGHT_CLICK_AIR || (ev.getPlayer().isSneaking() && ev.getAction()==Action.RIGHT_CLICK_AIR) || (ev.getPlayer().isSneaking() && ev.getAction()==Action.RIGHT_CLICK_BLOCK && !GenericFunctions.isDumpableContainer(ev.getClickedBlock().getType()))) {
if ((ev.getAction()==Action.RIGHT_CLICK_AIR || (ev.getPlayer().isSneaking() && ev.getAction()==Action.RIGHT_CLICK_AIR) || (ev.getPlayer().isSneaking() && ev.getAction()==Action.RIGHT_CLICK_BLOCK && !GenericFunctions.isDumpableContainer(ev.getClickedBlock().getType()))) && !PVP.isPvPing(ev.getPlayer())) {
if (ev.getPlayer().getInventory().getItemInMainHand().hasItemMeta() &&
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().hasLore() &&
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().getLore().size()>=4 &&
@ -4895,7 +4899,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
return;
}
} else
if (ev.getPlayer().isSneaking() && ev.getAction()==Action.RIGHT_CLICK_BLOCK && GenericFunctions.isDumpableContainer(ev.getClickedBlock().getType())) {
if (ev.getPlayer().isSneaking() && ev.getAction()==Action.RIGHT_CLICK_BLOCK && GenericFunctions.isDumpableContainer(ev.getClickedBlock().getType()) && !PVP.isPvPing(ev.getPlayer())) {
//This is an attempt to insert an item cube into a container. See what item cube we're holding.
if (ev.getPlayer().getInventory().getItemInMainHand().hasItemMeta() &&
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().hasLore() &&
@ -5699,7 +5703,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public void onPlayerDeath(PlayerDeathEvent ev) {
//Modify the death message. This is a fix for getting rid of the healthbar from the player name.
final Player p = ev.getEntity();
if (!p.getWorld().getName().contains("Instance")) {
if (!p.getWorld().getName().contains("Instance") && !PVP.isPvPing(p)) {
if (!DeathManager.deathStructureExists(p)) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.playermode_on_death=pd.lastmode;
@ -6471,6 +6475,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}*/
if (PVP.isPvPing(ev.getPlayer())) {
ev.setCancelled(true);
return;
}
ItemSet.updateItemSets(ev.getPlayer());
return;
}
@ -6868,7 +6876,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//Check for a right-click for a Bauble Pouch.
if (ev.getClick()==ClickType.RIGHT && ((ev.getInventory().getType()!=InventoryType.WORKBENCH && ev.getRawSlot()>=0) ||
(ev.getInventory().getType()==InventoryType.WORKBENCH && ev.getRawSlot()>9))) {
(ev.getInventory().getType()==InventoryType.WORKBENCH && ev.getRawSlot()>9)) && !PVP.isPvPing((Player)ev.getWhoClicked())) {
ItemStack item = ev.getCurrentItem();
if (BaublePouch.isBaublePouch(item)) {
BaublePouch.openBaublePouch((Player)ev.getWhoClicked(), item);
@ -7316,7 +7324,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
log("Inventory click.",5);
//WARNING! This only happens for ITEM CUBES! Do not add other items in here!
if (((ev.getInventory().getType()!=InventoryType.WORKBENCH && ev.getRawSlot()>=0) ||
(ev.getInventory().getType()==InventoryType.WORKBENCH && ev.getRawSlot()>9)) && ev.isRightClick() && ev.getCurrentItem()!=null && ev.getCurrentItem().getAmount()==1) {
(ev.getInventory().getType()==InventoryType.WORKBENCH && ev.getRawSlot()>9)) && ev.isRightClick() && ev.getCurrentItem()!=null && ev.getCurrentItem().getAmount()==1 &&
!PVP.isPvPing((Player)ev.getWhoClicked())) {
log("Clicked Item: "+ev.getCurrentItem().toString(),5);
if (ev.getCurrentItem().hasItemMeta()) {
log("Item Meta: "+ev.getCurrentItem().getItemMeta().toString(),5);
@ -9834,6 +9843,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
return;
}
Player p = ev.getPlayer();
if (PVP.isPvPing(p)) {
ev.setCancelled(true);
return;
}
//log("Item Right now: "+ev.getItem().getItemStack(),0);
long time = System.nanoTime();
long totaltime = System.nanoTime();
@ -9846,6 +9859,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//TwosideKeeper.log(" New Stack is: "+newstack,0);
if (newstack==null || newstack.getType()==Material.AIR) {
SoundUtils.playGlobalSound(ev.getPlayer().getLocation(), Sound.ENTITY_ITEM_PICKUP, 0.6f, SoundUtils.DetermineItemPitch(ev.getItem().getItemStack()));
PlayPickupParticle(ev.getPlayer(),ev.getItem());
if (ev.getRemaining()>0) {
Item it = ev.getItem();
it.getItemStack().setAmount(ev.getRemaining());

@ -826,8 +826,14 @@ final public class runServerHeartbeat implements Runnable {
} else {
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(ChatColor.RED+ChatColor.stripColor(GenericFunctions.PlayerModePrefix(p)));
}
} else {
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(p));
}
} else {
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(p));
}
} else {
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(p));
}
} else {
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(p));

Loading…
Cancel
Save