diff --git a/pom.xml b/pom.xml
index dfc74d1e..36dae57e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,7 +32,7 @@
strife
- 3.4.0
+ 3.4.1
jar
strife
diff --git a/src/main/java/land/face/strife/StrifePlugin.java b/src/main/java/land/face/strife/StrifePlugin.java
index c42c5493..dd5197b5 100644
--- a/src/main/java/land/face/strife/StrifePlugin.java
+++ b/src/main/java/land/face/strife/StrifePlugin.java
@@ -382,6 +382,8 @@ public void enable() {
.registerCompletion("spawners", c -> spawnerManager.getSpawnerMap().keySet());
commandManager.getCommandCompletions()
.registerCompletion("abilities", c -> abilityManager.getLoadedAbilities().keySet());
+ commandManager.getCommandCompletions()
+ .registerCompletion("buffs", c -> buffManager.getLoadedBuffIds());
levelingRate = new LevelingRate();
maxSkillLevel = settings.getInt("config.leveling.max-skill-level", 60);
diff --git a/src/main/java/land/face/strife/commands/StrifeCommand.java b/src/main/java/land/face/strife/commands/StrifeCommand.java
index 0f0dcaca..d7725cdb 100644
--- a/src/main/java/land/face/strife/commands/StrifeCommand.java
+++ b/src/main/java/land/face/strife/commands/StrifeCommand.java
@@ -1,18 +1,20 @@
/**
* The MIT License Copyright (c) 2015 Teal Cube Games
*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to the following conditions:
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
+ * associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute,
+ * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
*
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
- * Software.
+ * The above copyright notice and this permission notice shall be included in all copies or
+ * substantial portions of the Software.
*
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+ * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package land.face.strife.commands;
@@ -37,6 +39,7 @@
import land.face.strife.data.LoreAbility;
import land.face.strife.data.StrifeMob;
import land.face.strife.data.ability.Ability;
+import land.face.strife.data.buff.LoadedBuff;
import land.face.strife.data.champion.Champion;
import land.face.strife.data.champion.ChampionSaveData;
import land.face.strife.data.champion.LifeSkillType;
@@ -92,9 +95,12 @@ public void uniqueSummonCommand(Player sender, String entityId) {
@Subcommand("defeat")
@CommandCompletion("@players @players @range:1-30")
@CommandPermission("strife.admin")
- public void defeatCommand(CommandSender sender, OnlinePlayer winner, OnlinePlayer loser, @Default("10") double weight) {
- ChampionSaveData winData = plugin.getChampionManager().getChampion(winner.getPlayer()).getSaveData();
- ChampionSaveData loseData = plugin.getChampionManager().getChampion(loser.getPlayer()).getSaveData();
+ public void defeatCommand(CommandSender sender, OnlinePlayer winner, OnlinePlayer loser,
+ @Default("10") double weight) {
+ ChampionSaveData winData = plugin.getChampionManager().getChampion(winner.getPlayer())
+ .getSaveData();
+ ChampionSaveData loseData = plugin.getChampionManager().getChampion(loser.getPlayer())
+ .getSaveData();
EloResponse response = EloUtil
.getEloChange(winData.getPvpScore(), loseData.getPvpScore(), (float) weight);
@@ -106,9 +112,11 @@ public void defeatCommand(CommandSender sender, OnlinePlayer winner, OnlinePlaye
loseData.setPvpScore(response.getNewLoserValue());
sendActionBar(winner.getPlayer(), PVP_WIN_MSG.replace("{0}",
- String.valueOf(Math.round(response.getNewWinnerValue()))).replace("{1}", String.valueOf(Math.round(winDiff))));
+ String.valueOf(Math.round(response.getNewWinnerValue())))
+ .replace("{1}", String.valueOf(Math.round(winDiff))));
sendActionBar(loser.getPlayer(), PVP_LOSE_MSG.replace("{0}",
- String.valueOf(Math.round(response.getNewLoserValue()))).replace("{1}", String.valueOf(Math.round(loseDiff))));
+ String.valueOf(Math.round(response.getNewLoserValue())))
+ .replace("{1}", String.valueOf(Math.round(loseDiff))));
}
@Subcommand("cd|cooldown")
@@ -144,7 +152,8 @@ public void reloadCommand(CommandSender sender) {
MessageUtils.sendMessage(p,
"&a&o&lATTENTION GAMER: &a&oOkay we're back now thanks for waiting :)");
}
- sendMessage(sender, plugin.getSettings().getString("language.command.reload", "&aStrife reloaded!"));
+ sendMessage(sender,
+ plugin.getSettings().getString("language.command.reload", "&aStrife reloaded!"));
}
@Subcommand("profile")
@@ -157,7 +166,8 @@ public void profileCommand(CommandSender sender, OnlinePlayer target) {
new String[][]{{"%amount%", "" + champion.getUnusedStatPoints()}});
sendMessage(sender, "&6----------------------------------");
for (StrifeAttribute stat : plugin.getAttributeManager().getAttributes()) {
- sendMessage(sender, ChatColor.GRAY + stat.getKey() + " - " + champion.getAttributeLevel(stat));
+ sendMessage(sender,
+ ChatColor.GRAY + stat.getKey() + " - " + champion.getAttributeLevel(stat));
}
sendMessage(sender, "&6----------------------------------");
}
@@ -165,7 +175,8 @@ public void profileCommand(CommandSender sender, OnlinePlayer target) {
@Subcommand("mobinfo|info")
@CommandPermission("strife.info")
public void infoCommand(Player sender) {
- List targets = new ArrayList<>(TargetingUtil.getEntitiesInLine(sender.getEyeLocation(), 30, 2));
+ List targets = new ArrayList<>(
+ TargetingUtil.getEntitiesInLine(sender.getEyeLocation(), 30, 2));
targets.remove(sender);
if (targets.isEmpty()) {
sendMessage(sender, "&eNo target found...");
@@ -190,9 +201,11 @@ public void resetCommand(CommandSender sender, OnlinePlayer target) {
champion.setUnusedStatPoints(target.getPlayer().getLevel());
champion.getSaveData().getPathMap().clear();
plugin.getPathManager().buildPathBonus(champion);
- sendMessage(sender, "You reset %player%", new String[][]{{"%player%", target.getPlayer().getDisplayName()}});
+ sendMessage(sender, "You reset %player%",
+ new String[][]{{"%player%", target.getPlayer().getDisplayName()}});
sendMessage(target.getPlayer(), "&aYour stats have been reset!");
- sendMessage(target.getPlayer(), "&6You have unspent levelpoints! Use &f/levelup &6to spend them!");
+ sendMessage(target.getPlayer(),
+ "&6You have unspent levelpoints! Use &f/levelup &6to spend them!");
plugin.getChampionManager().update(target.getPlayer());
plugin.getStatUpdateManager().updateVanillaAttributes(champion.getPlayer());
}
@@ -209,7 +222,8 @@ public void clearCommand(CommandSender sender, OnlinePlayer target) {
}
champion.setUnusedStatPoints(0);
champion.setHighestReachedLevel(0);
- sendMessage(sender, "You cleared %player%", new String[][]{{"%player%", target.getPlayer().getDisplayName()}});
+ sendMessage(sender, "You cleared %player%",
+ new String[][]{{"%player%", target.getPlayer().getDisplayName()}});
sendMessage(target.getPlayer(), "&aYour stats have been wiped :O");
plugin.getChampionManager().update(target.getPlayer());
plugin.getStatUpdateManager().updateVanillaAttributes(champion.getPlayer());
@@ -229,7 +243,8 @@ public void raiseCommand(CommandSender sender, OnlinePlayer target, @Default("1"
Champion champion = plugin.getChampionManager().getChampion(target.getPlayer());
plugin.getChampionManager().update(target.getPlayer());
sendMessage(sender, "&aYou raised &f%player% &ato level &f%level%.",
- new String[][]{{"%player%", target.getPlayer().getDisplayName()}, {"%level%", "" + newLevel}});
+ new String[][]{{"%player%", target.getPlayer().getDisplayName()},
+ {"%level%", "" + newLevel}});
sendMessage(target.getPlayer(), "&aAn administrator has raised your level");
plugin.getStatUpdateManager().updateVanillaAttributes(champion.getPlayer());
}
@@ -269,7 +284,8 @@ public void removeAbilityCommand(CommandSender sender, OnlinePlayer target, int
sendMessage(sender, "Invalid slot: " + slot);
return;
}
- plugin.getChampionManager().getChampion(target.getPlayer()).getSaveData().setAbility(abilitySlot, null);
+ plugin.getChampionManager().getChampion(target.getPlayer()).getSaveData()
+ .setAbility(abilitySlot, null);
plugin.getAbilityIconManager().setAllAbilityIcons(target.getPlayer());
}
@@ -308,9 +324,11 @@ public void bindCommand(CommandSender sender, OnlinePlayer target, String loreAb
Champion champion = plugin.getChampionManager().getChampion(target.getPlayer());
boolean success = plugin.getChampionManager().addBoundLoreAbility(champion, ability);
if (success) {
- sendMessage(sender, "&aBound loreAbility " + loreAbilityId + " to player " + target.getPlayer().getName());
+ sendMessage(sender,
+ "&aBound loreAbility " + loreAbilityId + " to player " + target.getPlayer().getName());
} else {
- sendMessage(sender, "&cLoreAbility " + loreAbilityId + " already exists on " + target.getPlayer().getName());
+ sendMessage(sender,
+ "&cLoreAbility " + loreAbilityId + " already exists on " + target.getPlayer().getName());
}
}
@@ -326,9 +344,11 @@ public void unbindCommand(CommandSender sender, OnlinePlayer target, String lore
Champion champion = plugin.getChampionManager().getChampion(target.getPlayer());
boolean success = plugin.getChampionManager().removeBoundLoreAbility(champion, ability);
if (success) {
- sendMessage(sender, "&aUnbound loreAbility " + loreAbilityId + " to player " + target.getPlayer().getName());
+ sendMessage(sender,
+ "&aUnbound loreAbility " + loreAbilityId + " to player " + target.getPlayer().getName());
} else {
- sendMessage(sender, "&cLoreAbility " + loreAbilityId + " doesn't exist on " + target.getPlayer().getName());
+ sendMessage(sender,
+ "&cLoreAbility " + loreAbilityId + " doesn't exist on " + target.getPlayer().getName());
}
}
@@ -350,13 +370,15 @@ public void skillCommand(CommandSender sender, OnlinePlayer target, String skill
ChatColor color = type.getColor();
String name = type.getName();
- plugin.getChampionManager().getChampion(target.getPlayer()).getSaveData().setSkillLevel(type, newLevel);
+ plugin.getChampionManager().getChampion(target.getPlayer()).getSaveData()
+ .setSkillLevel(type, newLevel);
sendMessage(target.getPlayer(), SET_LEVEL_MSG
.replace("{c}", "" + color)
.replace("{n}", name)
.replace("{a}", Integer.toString(newLevel))
);
- sendMessage(sender, "Set " + name + " level of " + target.getPlayer().getName()+ " to " + newLevel);
+ sendMessage(sender,
+ "Set " + name + " level of " + target.getPlayer().getName() + " to " + newLevel);
}
@Subcommand("addskillxp|skillxp")
@@ -372,7 +394,8 @@ public void addSkillXp(CommandSender sender, OnlinePlayer target, String skill,
sendMessage(sender, "&cUnknown skill " + skill + "???");
return;
}
- plugin.getSkillExperienceManager().addExperience(target.getPlayer(), type, amount, exact, !silent);
+ plugin.getSkillExperienceManager()
+ .addExperience(target.getPlayer(), type, amount, exact, !silent);
}
@Subcommand("addxp")
@@ -381,19 +404,34 @@ public void addSkillXp(CommandSender sender, OnlinePlayer target, String skill,
public void addXpCommand(CommandSender sender, OnlinePlayer player, double amount) {
plugin.getExperienceManager().addExperience(player.getPlayer(), amount, true);
sendMessage(player.player, "&aYou gained &f" + (int) amount + " &aXP!");
- sendMessage(sender, "&a&oAwarded " + amount + " xp to " + player.getPlayer().getName() + " via command");
+ sendMessage(sender,
+ "&a&oAwarded " + amount + " xp to " + player.getPlayer().getName() + " via command");
}
@Subcommand("boost")
- @CommandCompletion("@boosts @players @range:1-1000000")
+ @CommandCompletion("@boosts @players @range:1-10")
@CommandPermission("strife.admin")
- public void startBoostCommand(CommandSender sender, String boostId, String creator, int duration) {
+ public void startBoostCommand(CommandSender sender, String boostId, String creator,
+ int duration) {
boolean success = plugin.getBoostManager().startBoost(creator, boostId, duration);
if (!success) {
sendMessage(sender, "&cBoost with that ID doesn't exist, or this boost is running");
}
}
+ @Subcommand("applybuff")
+ @CommandCompletion("@players @buffs @range:1-10")
+ @CommandPermission("strife.admin")
+ public void applyBuff(CommandSender sender, OnlinePlayer player, String buffId, int seconds) {
+ LoadedBuff buff = plugin.getBuffManager().getBuffFromId(buffId);
+ if (buff == null) {
+ sendMessage(sender, "&cBuff with that ID doesn't exist: " + buffId);
+ return;
+ }
+ plugin.getStrifeMobManager().getStatMob(player.getPlayer())
+ .addBuff(LoadedBuff.toRunningBuff(buff), seconds);
+ }
+
@Subcommand("reveal")
@CommandCompletion("@players")
@CommandPermission("strife.admin")
diff --git a/src/main/java/land/face/strife/data/buff/LoadedBuff.java b/src/main/java/land/face/strife/data/buff/LoadedBuff.java
index fbb9de1f..4250503f 100644
--- a/src/main/java/land/face/strife/data/buff/LoadedBuff.java
+++ b/src/main/java/land/face/strife/data/buff/LoadedBuff.java
@@ -33,4 +33,8 @@ public double getSeconds() {
return seconds;
}
+ public static Buff toRunningBuff(LoadedBuff buff) {
+ return new Buff(buff.id, buff.stats, buff.maxStacks);
+ }
+
}
diff --git a/src/main/java/land/face/strife/listeners/CombatListener.java b/src/main/java/land/face/strife/listeners/CombatListener.java
index 57b31c25..5f523baa 100644
--- a/src/main/java/land/face/strife/listeners/CombatListener.java
+++ b/src/main/java/land/face/strife/listeners/CombatListener.java
@@ -208,8 +208,6 @@ public void strifeDamageHandler(EntityDamageByEntityEvent event) {
return;
}
- Bukkit.getScheduler().runTaskLater(plugin, () -> defendEntity.setNoDamageTicks(0), 0L);
-
boolean isSneakAttack = attackEntity instanceof Player && plugin.getStealthManager()
.canSneakAttack((Player) attackEntity);
diff --git a/src/main/java/land/face/strife/listeners/UniqueSplashListener.java b/src/main/java/land/face/strife/listeners/UniqueSplashListener.java
index a13c057d..946e7e5b 100644
--- a/src/main/java/land/face/strife/listeners/UniqueSplashListener.java
+++ b/src/main/java/land/face/strife/listeners/UniqueSplashListener.java
@@ -28,7 +28,7 @@ public UniqueSplashListener(StrifePlugin plugin) {
@EventHandler(priority = EventPriority.HIGHEST)
public void onAbilityPotionSplash(PotionSplashEvent event) {
List hitEffects = ProjectileUtil.getHitEffects(event.getEntity());
- if (hitEffects.isEmpty()) {
+ if (hitEffects == null || hitEffects.isEmpty()) {
return;
}
if (!(event.getEntity().getShooter() instanceof LivingEntity)) {
diff --git a/src/main/java/land/face/strife/managers/BuffManager.java b/src/main/java/land/face/strife/managers/BuffManager.java
index 36ce4514..bc8e02c4 100644
--- a/src/main/java/land/face/strife/managers/BuffManager.java
+++ b/src/main/java/land/face/strife/managers/BuffManager.java
@@ -20,6 +20,7 @@
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
import land.face.strife.data.buff.Buff;
import land.face.strife.data.buff.LoadedBuff;
import land.face.strife.stats.StrifeStat;
@@ -42,6 +43,10 @@ public Buff buildFromLoadedBuff(LoadedBuff loadedBuff) {
return new Buff(loadedBuff.getId(), loadedBuff.getStats(), loadedBuff.getMaxStacks());
}
+ public Set getLoadedBuffIds() {
+ return buffList.keySet();
+ }
+
public void loadBuff(String key, ConfigurationSection cs) {
ConfigurationSection statsSection = cs.getConfigurationSection("stats");
Map statsMap = StatUtil.getStatMapFromSection(statsSection);
diff --git a/src/main/java/land/face/strife/managers/DamageManager.java b/src/main/java/land/face/strife/managers/DamageManager.java
index 8b283cee..4de608b8 100644
--- a/src/main/java/land/face/strife/managers/DamageManager.java
+++ b/src/main/java/land/face/strife/managers/DamageManager.java
@@ -59,15 +59,12 @@ public double dealDamage(StrifeMob attacker, StrifeMob defender, float damage, D
defender.getEntity().setHealth(defender.getEntity().getHealth() - damage);
return damage;
}
- int noDamageTicks = defender.getEntity().getNoDamageTicks();
Vector velocity = defender.getEntity().getVelocity();
- defender.getEntity().setNoDamageTicks(0);
handledDamages.put(attacker.getEntity().getUniqueId(), (double) damage);
defender.getEntity().damage(damage, attacker.getEntity());
handledDamages.remove(attacker.getEntity().getUniqueId());
- defender.getEntity().setNoDamageTicks(noDamageTicks);
defender.getEntity().setVelocity(velocity);
return damage;
diff --git a/src/main/java/land/face/strife/managers/StatUpdateManager.java b/src/main/java/land/face/strife/managers/StatUpdateManager.java
index 933fb6ab..b497ee1e 100644
--- a/src/main/java/land/face/strife/managers/StatUpdateManager.java
+++ b/src/main/java/land/face/strife/managers/StatUpdateManager.java
@@ -148,7 +148,6 @@ public void updateVanillaAttributes(Player player) {
}
public void updateVanillaAttributes(StrifeMob strifeMob) {
- strifeMob.getEntity().setMaximumNoDamageTicks(0);
updateMovementSpeed(strifeMob);
updateAttackAttrs(strifeMob);
updateHealth(strifeMob);
diff --git a/src/main/java/land/face/strife/managers/StrifeMobManager.java b/src/main/java/land/face/strife/managers/StrifeMobManager.java
index 3f8f49fb..bcc1f0ab 100644
--- a/src/main/java/land/face/strife/managers/StrifeMobManager.java
+++ b/src/main/java/land/face/strife/managers/StrifeMobManager.java
@@ -43,6 +43,7 @@ public StrifeMob getStatMob(LivingEntity entity) {
StatUtil.updateMaxEnergy(strifeMob) * ((Player) entity).getFoodLevel() / 20 : 200000);
trackedEntities.put(entity, strifeMob);
}
+ entity.setMaximumNoDamageTicks(0);
return trackedEntities.get(entity);
}