Skip to content

Commit

Permalink
Merge pull request #7 from PixelOutlaw/develop
Browse files Browse the repository at this point in the history
Ability System Release
  • Loading branch information
UltraFaceguy authored Mar 2, 2020
2 parents d92ecaa + a1647dd commit 6ab7f1f
Show file tree
Hide file tree
Showing 150 changed files with 4,518 additions and 1,534 deletions.
22 changes: 16 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
<parent>
<groupId>io.pixeloutlaw</groupId>
<artifactId>spigot-plugin-parent</artifactId>
<version>1.14.4.2</version>
<version>1.15.2.0</version>
</parent>

<artifactId>strife</artifactId>
<version>3.0.0</version>
<version>3.0.3-SNAPSHOT</version>
<packaging>jar</packaging>

<name>strife</name>
Expand All @@ -59,17 +59,21 @@
<id>md_5-public</id>
<url>http://repo.md-5.net/content/groups/public/</url>
</repository>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
</dependency>
<dependency>
<groupId>io.pixeloutlaw</groupId>
<artifactId>facecore</artifactId>
<version>1.14.4.1</version>
<version>1.15.2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -81,7 +85,13 @@
<dependency>
<groupId>LibsDisguises</groupId>
<artifactId>LibsDisguises</artifactId>
<version>9.8.2-SNAPSHOT</version>
<version>9.9.3-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.UltraFaceguy</groupId>
<artifactId>SnazzyParties</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
166 changes: 130 additions & 36 deletions src/main/java/land/face/strife/StrifePlugin.java

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions src/main/java/land/face/strife/commands/AgilityCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/**
* 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:
*
* 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.
*/
package land.face.strife.commands;

import static com.tealcube.minecraft.bukkit.facecore.utilities.MessageUtils.sendMessage;

import land.face.strife.StrifePlugin;
import org.bukkit.entity.Player;
import se.ranzdo.bukkit.methodcommand.Arg;
import se.ranzdo.bukkit.methodcommand.Command;

public class AgilityCommand {

private final StrifePlugin plugin;

public AgilityCommand(StrifePlugin plugin) {
this.plugin = plugin;
}

@Command(identifier = "agility create", permissions = "strife.command.agility")
public void creationCommand(Player sender, @Arg(name = "name") String name,
@Arg(name = "difficulty") double difficulty, @Arg(name = "xp") double xp) {

boolean success = plugin.getAgilityManager()
.createAgilityContainer(name, sender.getLocation(), (float) difficulty, (float) xp);

if (success) {
sendMessage(sender, "&eMAde it");
} else {
sendMessage(sender, "&efailed");
}
}

@Command(identifier = "agility add", permissions = "strife.command.agility")
public void addCommand(Player sender, @Arg(name = "name") String name) {

boolean success = plugin.getAgilityManager().addAgilityLocation(name, sender.getLocation());

if (success) {
sendMessage(sender, "&eMAde it");
} else {
sendMessage(sender, "&efailed");
}
}
}
30 changes: 21 additions & 9 deletions src/main/java/land/face/strife/commands/SpawnerCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@

import static com.tealcube.minecraft.bukkit.facecore.utilities.MessageUtils.sendMessage;

import java.util.ArrayList;
import java.util.List;
import land.face.strife.StrifePlugin;
import land.face.strife.data.Spawner;
import land.face.strife.data.UniqueEntity;
import land.face.strife.data.effects.TargetingComparators.SpawnerComparator;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import se.ranzdo.bukkit.methodcommand.Arg;
import se.ranzdo.bukkit.methodcommand.Command;
Expand All @@ -36,13 +40,13 @@ public SpawnerCommand(StrifePlugin plugin) {
}

@Command(identifier = "spawner create", permissions = "strife.command.spawner")
public void creationCommand(Player sender, @Arg(name = "spawnerName") String spawnerName,
public void creationCommand(Player sender, @Arg(name = "spawnerName") String spawnerId,
@Arg(name = "uniqueName") String uniqueName, @Arg(name = "amount") int amount,
@Arg(name = "leashRange") double leashRange,
@Arg(name = "respawnDelaySeconds") int respawnSecs) {

if (plugin.getSpawnerManager().getSpawnerMap().containsKey(spawnerName)) {
sendMessage(sender, "&eA spawner with the name " + spawnerName + " already exists!");
if (plugin.getSpawnerManager().getSpawnerMap().containsKey(spawnerId)) {
sendMessage(sender, "&eA spawner with the name " + spawnerId + " already exists!");
return;
}
UniqueEntity uniqueEntity = plugin.getUniqueEntityManager().getLoadedUniquesMap()
Expand All @@ -52,10 +56,10 @@ public void creationCommand(Player sender, @Arg(name = "spawnerName") String spa
return;
}

Spawner spawner = new Spawner(uniqueEntity, uniqueName, amount, sender.getLocation(),
respawnSecs, leashRange);
plugin.getSpawnerManager().addSpawner(spawnerName, spawner);
sendMessage(sender, "&aSpawner &f" + spawnerName + " &asuccessfully added!");
Spawner spawner = new Spawner(spawnerId, uniqueEntity, uniqueName, amount,
sender.getLocation(), respawnSecs, leashRange);
plugin.getSpawnerManager().addSpawner(spawnerId, spawner);
sendMessage(sender, "&aSpawner &f" + spawnerId + " &asuccessfully added!");
}

@Command(identifier = "spawner delete", permissions = "strife.command.spawner")
Expand All @@ -72,8 +76,16 @@ public void deleteSpawnerCommand(Player sender, @Arg(name = "spawnerName") Strin
public void spawnerList(Player sender) {
sendMessage(sender, "&2&lList of loaded spawners:");
StringBuilder listString = new StringBuilder();
for (String s : plugin.getSpawnerManager().getSpawnerMap().keySet()) {
listString.append(s).append(" ");
List<Spawner> spawners = new ArrayList<>(plugin.getSpawnerManager().getSpawnerMap().values());
SpawnerComparator comparator = new SpawnerComparator();
comparator.setLoc(sender.getLocation());
spawners.sort(comparator);
for (Spawner s : spawners) {
if (s.getLocation().getWorld() == sender.getLocation().getWorld()) {
listString.append(ChatColor.WHITE).append(s.getId()).append(" ");
} else {
listString.append(ChatColor.GRAY).append(s.getId()).append(" ");
}
}
sendMessage(sender, "&f" + listString.toString());
}
Expand Down
7 changes: 2 additions & 5 deletions src/main/java/land/face/strife/commands/StrifeCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import land.face.strife.data.champion.Champion;
import land.face.strife.data.champion.LifeSkillType;
import land.face.strife.data.champion.StrifeAttribute;
import land.face.strife.menus.abilities.AbilityPickerMenu.AbilityMenuType;
import land.face.strife.stats.AbilitySlot;
import land.face.strife.util.TargetingUtil;
import org.bukkit.Bukkit;
Expand Down Expand Up @@ -203,10 +202,8 @@ public void removeAbilityCommand(CommandSender sender, @Arg(name = "target") Pla
}

@Command(identifier = "strife ability menu", permissions = "strife.command.strife.binding", onlyPlayers = false)
public void menuAbilityCommand(CommandSender sender, @Arg(name = "target") Player target,
@Arg(name = "menu") String id) {
AbilityMenuType menuType = AbilityMenuType.valueOf(id);
plugin.getAbilityPicker(menuType).open(target);
public void menuAbilityCommand(CommandSender sender, @Arg(name = "target") Player target) {
plugin.getAbilityPicker().open(target);
}

@Command(identifier = "strife bind", permissions = "strife.command.strife.binding", onlyPlayers = false)
Expand Down
78 changes: 78 additions & 0 deletions src/main/java/land/face/strife/commands/StyleCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/**
* 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:
*
* 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.
*/
package land.face.strife.commands;

import static com.tealcube.minecraft.bukkit.facecore.utilities.MessageUtils.sendMessage;

import java.util.ArrayList;
import land.face.strife.StrifePlugin;
import land.face.strife.data.champion.Champion;
import land.face.strife.stats.AbilitySlot;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import se.ranzdo.bukkit.methodcommand.Arg;
import se.ranzdo.bukkit.methodcommand.Command;

public class StyleCommand {

private final StrifePlugin plugin;

public StyleCommand(StrifePlugin plugin) {
this.plugin = plugin;
}

@Command(identifier = "strife style add", permissions = "strife.command.ability-style", onlyPlayers = true)
public void addStyleCommand(CommandSender sender, @Arg(name = "slot") String slot,
@Arg(name = "text") String text) {
AbilitySlot abilitySlot;
try {
abilitySlot = AbilitySlot.valueOf(slot);
} catch (Exception e) {
sendMessage(sender, "&cValid slots are: SLOT_A, SLOT_B, SLOT_C");
return;
}
if (abilitySlot != AbilitySlot.SLOT_A && abilitySlot != AbilitySlot.SLOT_B
&& abilitySlot != AbilitySlot.SLOT_C) {
sendMessage(sender, "&cValid slots are: SLOT_A, SLOT_B, SLOT_C");
return;
}
Champion champion = plugin.getChampionManager().getChampion((Player) sender);
champion.getSaveData().getCastMessages().computeIfAbsent(abilitySlot, k -> new ArrayList<>());
champion.getSaveData().getCastMessages().get(abilitySlot).add(text);
}

@Command(identifier = "strife style clear", permissions = "strife.command.ability-style", onlyPlayers = true)
public void clearStyleCommand(CommandSender sender, @Arg(name = "slot") String slot) {
AbilitySlot abilitySlot;
try {
abilitySlot = AbilitySlot.valueOf(slot);
} catch (Exception e) {
sendMessage(sender, "&cValid slots are: SLOT_A, SLOT_B, SLOT_C");
return;
}
if (abilitySlot != AbilitySlot.SLOT_A && abilitySlot != AbilitySlot.SLOT_B
&& abilitySlot != AbilitySlot.SLOT_C) {
sendMessage(sender, "&cValid slots are: SLOT_A, SLOT_B, SLOT_C");
return;
}
Champion champion = plugin.getChampionManager().getChampion((Player) sender);
champion.getSaveData().getCastMessages().computeIfAbsent(abilitySlot, k -> new ArrayList<>());
champion.getSaveData().getCastMessages().get(abilitySlot).clear();
}
}
96 changes: 96 additions & 0 deletions src/main/java/land/face/strife/data/AgilityLocationContainer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package land.face.strife.data;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.entity.Player;

public class AgilityLocationContainer {

private Map<UUID, Integer> progress = new HashMap<>();

private String name;
private float exp;
private float difficulty;
private List<Location> locations = new ArrayList<>();

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public float getExp() {
return exp;
}

public void setExp(float exp) {
this.exp = exp;
}

public float getDifficulty() {
return difficulty;
}

public void setDifficulty(float difficulty) {
this.difficulty = difficulty;
}

public List<Location> getLocations() {
return locations;
}

public Map<UUID, Integer> getProgress() {
return progress;
}

public static void checkStart(AgilityLocationContainer cont, Player player, Location loc) {
if (!cont.getProgress().containsKey(player.getUniqueId())) {
if (loc.distanceSquared(cont.getLocations().get(0)) < 2) {
cont.getProgress().put(player.getUniqueId(), 0);
if (cont.getLocations().get(1) != null) {
player.spawnParticle(Particle.FIREWORKS_SPARK, cont.getLocations().get(1), 10, 0.5, 0.5,
0.5, 0);
}
}
}
}

public static boolean setProgress(AgilityLocationContainer cont, Player player, Location loc) {
if (!cont.getProgress().containsKey(player.getUniqueId())) {
return false;
}
if (cont.getLocations().size() == 1) {
Bukkit.getLogger().warning("Agility set " + cont.getName() + "has only 1 location");
return false;
}
int progress = cont.getProgress().get(player.getUniqueId());
if (loc.distanceSquared(cont.getLocations().get(progress + 1)) < 2) {
if (progress + 2 == cont.getLocations().size()) {
cont.getProgress().remove(player.getUniqueId());
player.playSound(loc, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
return true;
} else {
cont.getProgress().put(player.getUniqueId(), progress + 1);
player.playSound(loc, Sound.ENTITY_CHICKEN_EGG, 1, 2);
player.spawnParticle(Particle.FIREWORKS_SPARK,
cont.getLocations().get(progress + 2), 10, 0.5, 0.5, 0.5, 0);
return false;
}
}
if (loc.distanceSquared(cont.getLocations().get(progress)) < 2) {
return false;
}
cont.getProgress().remove(player.getUniqueId());
player.playSound(loc, Sound.BLOCK_NOTE_BLOCK_BASS, 1, 0.7f);
return false;
}
}
Loading

0 comments on commit 6ab7f1f

Please sign in to comment.