optimize import and code reformat
This commit is contained in:
parent
36f8e3f6f0
commit
64ef73f7e0
15 changed files with 379 additions and 371 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue