Skip to content

Commit

Permalink
Merge pull request #26 from PixelOutlaw/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
UltraFaceguy committed May 21, 2021
2 parents 6339164 + 586a0d7 commit cd1be3d
Show file tree
Hide file tree
Showing 62 changed files with 1,088 additions and 471 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</parent>

<artifactId>strife</artifactId>
<version>3.4.0</version>
<version>3.4.1</version>
<packaging>jar</packaging>

<name>strife</name>
Expand Down
12 changes: 10 additions & 2 deletions src/main/java/land/face/strife/StrifePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -472,7 +474,7 @@ public void enable() {
Bukkit.getPluginManager().registerEvents(new SpawnListener(this), this);
Bukkit.getPluginManager().registerEvents(new MoneyDropListener(this), this);
Bukkit.getPluginManager().registerEvents(new ShearsEquipListener(), this);
Bukkit.getPluginManager().registerEvents(new MinionListener(strifeMobManager), this);
Bukkit.getPluginManager().registerEvents(new MinionListener(this), this);
Bukkit.getPluginManager().registerEvents(new TargetingListener(this), this);
Bukkit.getPluginManager().registerEvents(new FallListener(this), this);
Bukkit.getPluginManager().registerEvents(new LaunchAndLandListener(this), this);
Expand Down Expand Up @@ -517,7 +519,7 @@ public void enable() {
abilitySubcategoryMenu = new AbilityMenu(this, pickerName, pickerItems);
levelupMenu = new LevelupMenu(this, getAttributeManager().getAttributes());
confirmMenu = new ConfirmationMenu(this);
statsMenu = new StatsMenu();
statsMenu = new StatsMenu(this);
for (Path path : LevelPath.PATH_VALUES) {
pathMenus.put(path, new PathMenu(this, path));
}
Expand Down Expand Up @@ -753,6 +755,10 @@ public void loadSpawners() {

Spawner spawner = new Spawner(spawnerId, uniqueEntity, uniqueId, amount, loc,
respawnSeconds, leashRange);

spawner.setStartTime(cs.getInt("start-time", -1));
spawner.setEndTime(cs.getInt("end-time", -1));

spawners.put(spawnerId, spawner);
spawnerManager.setSpawnerMap(spawners);
}
Expand Down Expand Up @@ -781,6 +787,8 @@ private void saveSpawners() {
spawnerYAML.set(spawnerId + ".location.x", spawner.getLocation().getX());
spawnerYAML.set(spawnerId + ".location.y", spawner.getLocation().getY());
spawnerYAML.set(spawnerId + ".location.z", spawner.getLocation().getZ());
spawnerYAML.set(spawnerId + ".start-time", spawner.getStartTime());
spawnerYAML.set(spawnerId + ".end-time", spawner.getEndTime());
LogUtil.printDebug("Saved spawner " + spawnerId + ".");
}
spawnerYAML.save();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/land/face/strife/commands/InspectCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void baseCommand(Player sender) {
plugin.getChampionManager().updateEquipmentStats(sender);
plugin.getChampionManager().update(sender);
plugin.getStatUpdateManager().updateVanillaAttributes(sender);
plugin.getStatsMenu().setTargetPlayer(sender);
plugin.getStatsMenu().getInspectionTargetMap().put(sender, sender);
plugin.getStatsMenu().open(sender);
}

Expand All @@ -52,7 +52,7 @@ public void inspectCommand(Player sender, OnlinePlayer target) {
MessageUtils.sendMessage(sender, "&eThis player is offline or doesn't exist!");
return;
}
plugin.getStatsMenu().setTargetPlayer(target.getPlayer());
plugin.getStatsMenu().getInspectionTargetMap().put(sender, target.getPlayer());
plugin.getStatsMenu().open(sender);
}

Expand Down
26 changes: 26 additions & 0 deletions src/main/java/land/face/strife/commands/SpawnerCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,30 @@ public void updateRespawnCommand(String spawnerName, int seconds) {
sendMessage(sender, "&aUpdated respawn time range of &f" + spawnerName + " &ato &f" + seconds);
}

@Subcommand("update startTime")
@CommandCompletion("@spawners @range:1-200")
@CommandPermission("strife.spawners")
public void updateStartTime(String spawnerName, int time) {
Player sender = getCurrentCommandIssuer().getIssuer();
if (!plugin.getSpawnerManager().getSpawnerMap().containsKey(spawnerName)) {
sendMessage(sender, "&eNo spawner with the name " + spawnerName + " name exists!");
return;
}
plugin.getSpawnerManager().getSpawnerMap().get(spawnerName).setStartTime(time);
sendMessage(sender, "&aUpdated start time of &f" + spawnerName + " &ato &f" + time);
}

@Subcommand("update endTime")
@CommandCompletion("@spawners @range:1-200")
@CommandPermission("strife.spawners")
public void updateEndTime(String spawnerName, int time) {
Player sender = getCurrentCommandIssuer().getIssuer();
if (!plugin.getSpawnerManager().getSpawnerMap().containsKey(spawnerName)) {
sendMessage(sender, "&eNo spawner with the name " + spawnerName + " name exists!");
return;
}
plugin.getSpawnerManager().getSpawnerMap().get(spawnerName).setEndTime(time);
sendMessage(sender, "&aUpdated end time of &f" + spawnerName + " &ato &f" + time);
}

}
107 changes: 73 additions & 34 deletions src/main/java/land/face/strife/commands/StrifeCommand.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
/**
* The MIT License Copyright (c) 2015 Teal Cube Games
* <p>
* 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:
* <p>
* 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.
* <p>
* 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;

Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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")
Expand Down Expand Up @@ -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")
Expand All @@ -157,15 +166,17 @@ 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----------------------------------");
}

@Subcommand("mobinfo|info")
@CommandPermission("strife.info")
public void infoCommand(Player sender) {
List<LivingEntity> targets = new ArrayList<>(TargetingUtil.getEntitiesInLine(sender.getEyeLocation(), 30, 2));
List<LivingEntity> targets = new ArrayList<>(
TargetingUtil.getEntitiesInLine(sender.getEyeLocation(), 30, 2));
targets.remove(sender);
if (targets.isEmpty()) {
sendMessage(sender, "&eNo target found...");
Expand All @@ -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());
}
Expand All @@ -209,7 +222,8 @@ public void clearCommand(CommandSender sender, OnlinePlayer target) {
}
champion.setUnusedStatPoints(0);
champion.setHighestReachedLevel(0);
sendMessage(sender, "You cleared <white>%player%", new String[][]{{"%player%", target.getPlayer().getDisplayName()}});
sendMessage(sender, "You cleared <white>%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());
Expand All @@ -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());
}
Expand Down Expand Up @@ -269,7 +284,8 @@ public void removeAbilityCommand(CommandSender sender, OnlinePlayer target, int
sendMessage(sender, "<red>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());
}

Expand Down Expand Up @@ -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());
}
}

Expand All @@ -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());
}
}

Expand All @@ -350,19 +370,22 @@ 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")
@CommandCompletion("@players @skills @range:1-100000 true|false true|false")
@CommandPermission("strife.admin")
public void addSkillXp(CommandSender sender, OnlinePlayer target, String skill, int amount, boolean exact, boolean silent) {
public void addSkillXp(CommandSender sender, OnlinePlayer target, String skill, int amount,
@Default("true") boolean exact, @Default("false") boolean silent) {
String skillName = skill.toUpperCase();
LifeSkillType type;
try {
Expand All @@ -371,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")
Expand All @@ -380,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")
Expand Down
Loading

0 comments on commit cd1be3d

Please sign in to comment.