Skip to content

Commit

Permalink
Moving MoveUtil to Facecore>
Browse files Browse the repository at this point in the history
  • Loading branch information
UltraFaceguy committed Aug 25, 2020
1 parent d602e54 commit 637ec69
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 232 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</parent>

<artifactId>strife</artifactId>
<version>3.2.2</version>
<version>3.2.3</version>
<packaging>jar</packaging>

<name>strife</name>
Expand Down Expand Up @@ -81,7 +81,7 @@
<dependency>
<groupId>io.pixeloutlaw</groupId>
<artifactId>facecore</artifactId>
<version>1.16.2.8</version>
<version>1.16.2.10</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/land/face/strife/StrifePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ The MIT License Copyright (c) 2015 Teal Cube Games
import land.face.strife.listeners.LoreAbilityListener;
import land.face.strife.listeners.MinionListener;
import land.face.strife.listeners.MoneyDropListener;
import land.face.strife.listeners.MoveListener;
import land.face.strife.listeners.ShootListener;
import land.face.strife.listeners.SkillLevelUpListener;
import land.face.strife.listeners.SpawnListener;
Expand Down Expand Up @@ -502,7 +501,6 @@ public void enable() {
Bukkit.getPluginManager().registerEvents(new SwingListener(this), this);
Bukkit.getPluginManager().registerEvents(new ShootListener(this), this);
Bukkit.getPluginManager().registerEvents(new ChatListener(), this);
Bukkit.getPluginManager().registerEvents(new MoveListener(), this);
Bukkit.getPluginManager().registerEvents(new DataListener(this), this);
Bukkit.getPluginManager().registerEvents(new DeathListener(this), this);
Bukkit.getPluginManager().registerEvents(new SkillLevelUpListener(settings), this);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package land.face.strife.data.conditions;

import com.tealcube.minecraft.bukkit.facecore.utilities.MoveUtil;
import land.face.strife.data.StrifeMob;
import land.face.strife.util.MoveUtil;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;

public class GroundedCondition extends Condition {

private boolean strict;
private final boolean strict;

public GroundedCondition(boolean strict) {
this.strict = strict;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package land.face.strife.data.conditions;

import com.tealcube.minecraft.bukkit.facecore.utilities.MoveUtil;
import land.face.strife.data.StrifeMob;
import land.face.strife.util.MoveUtil;
import org.bukkit.entity.Player;

public class MovingCondition extends Condition {
Expand Down
38 changes: 0 additions & 38 deletions src/main/java/land/face/strife/events/LandEvent.java

This file was deleted.

38 changes: 0 additions & 38 deletions src/main/java/land/face/strife/events/LaunchEvent.java

This file was deleted.

28 changes: 16 additions & 12 deletions src/main/java/land/face/strife/listeners/DoubleJumpListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

import static land.face.strife.data.champion.LifeSkillType.AGILITY;

import com.tealcube.minecraft.bukkit.TextUtils;
import com.tealcube.minecraft.bukkit.facecore.utilities.MessageUtils;
import com.tealcube.minecraft.bukkit.facecore.event.LandEvent;
import com.tealcube.minecraft.bukkit.facecore.utilities.AdvancedActionBarUtil;
import com.tealcube.minecraft.bukkit.facecore.utilities.MoveUtil;
import io.pixeloutlaw.minecraft.spigot.garbage.StringExtensionsKt;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import land.face.strife.StrifePlugin;
import land.face.strife.data.StrifeMob;
import land.face.strife.data.champion.LifeSkillType;
import land.face.strife.events.LandEvent;
import land.face.strife.util.MoveUtil;
import land.face.strife.util.JumpUtil;
import land.face.strife.util.PlayerDataUtil;
import org.bukkit.GameMode;
import org.bukkit.Particle;
Expand All @@ -29,6 +30,7 @@ public class DoubleJumpListener implements Listener {

private final StrifePlugin plugin;
private final Map<Integer, Vector> cachedJumpAnimation = new HashMap<>();
private final String JUMP_AB_KEY = "air-jump";

public DoubleJumpListener(StrifePlugin plugin) {
this.plugin = plugin;
Expand All @@ -55,12 +57,13 @@ private void resetJumps(Player player) {
StrifeMob mob = plugin.getStrifeMobManager().getStatMob(player);
int agilityLevel = mob.getChampion().getLifeSkillLevel(AGILITY);
if (agilityLevel > 39) {
int jumps = MoveUtil.getJumps(player);
int maxJumps = MoveUtil.getMaxJumps(mob);
int jumps = JumpUtil.getJumps(player);
int maxJumps = JumpUtil.getMaxJumps(mob);
if (jumps != maxJumps) {
MessageUtils.sendActionBar(player, TextUtils.color("&bJumps Recharged!"));
String message = StringExtensionsKt.chatColorize("&bJumps Recharged!");
AdvancedActionBarUtil.addMessage(player, JUMP_AB_KEY, message, 10, 0);
}
MoveUtil.setJumps(player, maxJumps);
JumpUtil.setJumps(player, maxJumps);
}
}

Expand All @@ -74,7 +77,7 @@ public void airJump(PlayerToggleSneakEvent event) {
return;
}

int jumps = MoveUtil.getJumps(event.getPlayer());
int jumps = JumpUtil.getJumps(event.getPlayer());
if (event.getPlayer().getFoodLevel() < 6 || jumps < 1) {
return;
}
Expand Down Expand Up @@ -105,13 +108,14 @@ public void airJump(PlayerToggleSneakEvent event) {
event.getPlayer().setVelocity(velocity.add(bonusVelocity));

jumps--;
MoveUtil.setJumps(event.getPlayer(), jumps);
JumpUtil.setJumps(event.getPlayer(), jumps);

int maxJumps = MoveUtil.getMaxJumps(mob);
int maxJumps = JumpUtil.getMaxJumps(mob);

String bars = IntStream.range(0, maxJumps).mapToObj(i -> "▌").collect(Collectors.joining(""));
bars = insert(bars, "&0", Math.min(jumps, maxJumps));
MessageUtils.sendActionBar(event.getPlayer(), TextUtils.color("&3&lAir Jumps: &b" + bars));
String message = StringExtensionsKt.chatColorize("&3&lAir Jumps: &b" + bars);
AdvancedActionBarUtil.addMessage(event.getPlayer(), JUMP_AB_KEY, message, 40, 0);

plugin.getSkillExperienceManager().addExperience(mob, LifeSkillType.AGILITY, 3, false, false);
flingParticle(event.getPlayer());
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/land/face/strife/listeners/FallListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

import com.tealcube.minecraft.bukkit.TextUtils;
import com.tealcube.minecraft.bukkit.facecore.utilities.MessageUtils;
import com.tealcube.minecraft.bukkit.facecore.utilities.MoveUtil;
import land.face.strife.StrifePlugin;
import land.face.strife.data.champion.Champion;
import land.face.strife.data.champion.LifeSkillType;
import land.face.strife.util.DamageUtil;
import land.face.strife.util.MoveUtil;
import land.face.strife.util.SpecialStatusUtil;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
Expand All @@ -23,8 +23,8 @@

public class FallListener implements Listener {

private StrifePlugin plugin;
private int fallMs;
private final StrifePlugin plugin;
private final int fallMs;

public FallListener(StrifePlugin plugin) {
this.plugin = plugin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import static land.face.strife.data.champion.LifeSkillType.AGILITY;

import com.tealcube.minecraft.bukkit.facecore.event.LandEvent;
import com.tealcube.minecraft.bukkit.facecore.event.LaunchEvent;
import com.tealcube.minecraft.bukkit.facecore.utilities.MoveUtil;
import land.face.strife.StrifePlugin;
import land.face.strife.data.AgilityLocationContainer;
import land.face.strife.data.StrifeMob;
import land.face.strife.data.champion.Champion;
import land.face.strife.data.champion.LifeSkillType;
import land.face.strife.events.LandEvent;
import land.face.strife.events.LaunchEvent;
import land.face.strife.stats.StrifeStat;
import land.face.strife.util.MoveUtil;
import land.face.strife.util.PlayerDataUtil;
import org.bukkit.GameMode;
import org.bukkit.Particle;
Expand All @@ -22,7 +22,7 @@

public class LaunchAndLandListener implements Listener {

private StrifePlugin plugin;
private final StrifePlugin plugin;

public LaunchAndLandListener(StrifePlugin plugin) {
this.plugin = plugin;
Expand Down Expand Up @@ -74,17 +74,15 @@ public void onLaunch(LaunchEvent event) {

@EventHandler
public void onLand(LandEvent event) {
for (AgilityLocationContainer cont : plugin.getAgilityManager().getInWorld(event.getLocation()
.getWorld().getName())) {
boolean success = AgilityLocationContainer
.setProgress(cont, event.getPlayer(), event.getLocation());
for (AgilityLocationContainer cont : plugin.getAgilityManager()
.getInWorld(event.getLocation().getWorld().getName())) {
boolean success = AgilityLocationContainer.setProgress(cont, event.getPlayer(), event.getLocation());
if (success) {
Champion champion = plugin.getChampionManager().getChampion(event.getPlayer());
float xp = cont.getExp();
xp *= PlayerDataUtil.getLifeSkillLevel(champion, AGILITY) / cont.getDifficulty();
xp = Math.min(cont.getExp(), xp);
plugin.getSkillExperienceManager()
.addExperience(event.getPlayer(), AGILITY, xp, false, false);
plugin.getSkillExperienceManager().addExperience(event.getPlayer(), AGILITY, xp, false, false);
}
}
}
Expand Down
37 changes: 0 additions & 37 deletions src/main/java/land/face/strife/listeners/MoveListener.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
*/
package land.face.strife.managers;

import com.tealcube.minecraft.bukkit.facecore.utilities.MoveUtil;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import land.face.strife.StrifePlugin;
import land.face.strife.data.champion.LifeSkillType;
import land.face.strife.managers.IndicatorManager.IndicatorStyle;
import land.face.strife.util.MoveUtil;
import land.face.strife.util.PlayerDataUtil;
import land.face.strife.util.StatUtil;
import org.bukkit.Bukkit;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/land/face/strife/tasks/EnergyRegenTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package land.face.strife.tasks;

import com.tealcube.minecraft.bukkit.facecore.utilities.MoveUtil;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -27,7 +28,6 @@
import land.face.strife.data.champion.LifeSkillType;
import land.face.strife.stats.StrifeStat;
import land.face.strife.stats.StrifeTrait;
import land.face.strife.util.MoveUtil;
import land.face.strife.util.PlayerDataUtil;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/land/face/strife/tasks/EveryTickTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,12 @@
package land.face.strife.tasks;

import land.face.strife.StrifePlugin;
import land.face.strife.util.MoveUtil;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;

public class EveryTickTask extends BukkitRunnable {

@Override
public void run() {
for (Player player : Bukkit.getOnlinePlayers()) {
MoveUtil.setSneak(player);
if (player.isOnGround()) {
MoveUtil.setLastGrounded(player);
}
}
StrifePlugin.getInstance().getBlockManager().tickHolograms();
}
}
Loading

0 comments on commit 637ec69

Please sign in to comment.