12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- package me.km.playerbank;
- import java.sql.Connection;
- import java.util.HashMap;
- import java.util.UUID;
- import me.km.api.Location;
- import me.km.api.Module;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.util.text.TextFormatting;
- public class PlayerManager extends Module
- {
- private final HashMap<UUID, Location> backLocation;
- private final PlayerBank bank;
-
- public PlayerManager(String mname, String prefix, TextFormatting color, Connection c)
- {
- super(mname, prefix, color);
- backLocation = new HashMap<>();
- bank = new PlayerBank(this, c);
- super.setDataBank(bank);
- }
- public PlayerBank getDataBank()
- {
- return bank;
- }
-
- public Location saveLocation(EntityPlayer p)
- {
- return backLocation.put(p.getUniqueID(), new Location(p.world, p.getPositionVector()));
- }
-
- public Location getLastLocation(EntityPlayer p)
- {
- return backLocation.get(p.getUniqueID());
- }
-
- public int getGuildId(EntityPlayer p)
- {
- int i = bank.getTag(p, "gilde");
- if(i == 0)
- {
- i = -bank.getIdByUUID(p.getUniqueID().toString());
- }
- return i;
- }
-
- public boolean getPvpStatus(EntityPlayer p)
- {
- return bank.getTag(p, "pvp") >= 1;
- }
-
- public void setPvpStatus(EntityPlayer p, boolean b)
- {
- bank.setTag(p, "pvp", b ? 1 : 0);
- }
- }
|