optimize import and code reformat

This commit is contained in:
unurled 2024-02-27 21:00:24 +01:00
parent 36f8e3f6f0
commit 64ef73f7e0
Signed by: unurled
GPG key ID: FDBC9CBE1F82423F
15 changed files with 379 additions and 371 deletions

View file

@ -7,28 +7,28 @@ import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
public class SRPlayerUtils {
public static void syncPlayerToSR(Player p, SRPlayer sr) {
sr.setInventory(p.getInventory());
sr.setPotionEffects((List<PotionEffect>) p.getActivePotionEffects());
public static void syncPlayerToSR(Player p, SRPlayer sr) {
sr.setInventory(p.getInventory());
sr.setPotionEffects((List<PotionEffect>) p.getActivePotionEffects());
}
public static void syncSRToPlayer(SRPlayer sr, Player p) {
p.getInventory().setContents(sr.getInventory().getContents());
// agility (speed)
// default is 100 so 0.2
float value = (float) (sr.getAttribute(Attribute.AGILITY) / 500.0);
p.setFlySpeed(value);
p.setWalkSpeed(value);
for (PotionEffect pe : sr.getPotionEffects()) {
p.addPotionEffect(pe);
}
public static void syncSRToPlayer(SRPlayer sr, Player p) {
p.getInventory().setContents(sr.getInventory().getContents());
// agility (speed)
// default is 100 so 0.2
float value = (float) (sr.getAttribute(Attribute.AGILITY) / 500.0);
p.setFlySpeed(value);
p.setWalkSpeed(value);
for (PotionEffect pe : sr.getPotionEffects()) {
p.addPotionEffect(pe);
}
// health
// default is 100 so 20
p.setHealth(sr.getAttribute(Attribute.HEALTH) / 5);
p.sendHealthUpdate();
p.updateInventory();
}
// health
// default is 100 so 20
p.setHealth(sr.getAttribute(Attribute.HEALTH) / 5);
p.sendHealthUpdate();
p.updateInventory();
}
}