mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 19:50:37 +00:00
Revert "Bad Commit 2, will revert."
This reverts commit 10801eb17501ba4f305f6a78d287d5715fcd7c93.
This commit is contained in:
parent
8127c5eefe
commit
824ad95fbe
2 changed files with 0 additions and 88 deletions
|
@ -1,16 +1,11 @@
|
||||||
package com.projectkorra.ProjectKorra;
|
package com.projectkorra.ProjectKorra;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class BendingPlayer {
|
public class BendingPlayer {
|
||||||
|
|
||||||
public static ConcurrentHashMap<String, BendingPlayer> players = new ConcurrentHashMap<String, BendingPlayer>();
|
public static ConcurrentHashMap<String, BendingPlayer> players = new ConcurrentHashMap<String, BendingPlayer>();
|
||||||
|
@ -26,7 +21,6 @@ public class BendingPlayer {
|
||||||
private long slowTime = 0;
|
private long slowTime = 0;
|
||||||
private boolean tremorsense = true;
|
private boolean tremorsense = true;
|
||||||
boolean blockedChi;
|
boolean blockedChi;
|
||||||
long lastTime = 0;
|
|
||||||
|
|
||||||
public BendingPlayer(UUID uuid, String player, ArrayList<Element> elements, HashMap<Integer, String> abilities, boolean permaRemoved) {
|
public BendingPlayer(UUID uuid, String player, ArrayList<Element> elements, HashMap<Integer, String> abilities, boolean permaRemoved) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
|
@ -37,29 +31,9 @@ public class BendingPlayer {
|
||||||
this.permaRemoved = permaRemoved;
|
this.permaRemoved = permaRemoved;
|
||||||
isToggled = true;
|
isToggled = true;
|
||||||
blockedChi = false;
|
blockedChi = false;
|
||||||
lastTime = System.currentTimeMillis();
|
|
||||||
|
|
||||||
players.put(player, this);
|
players.put(player, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BendingPlayer(Player player) {
|
|
||||||
this.uuid = player.getUniqueId();
|
|
||||||
this.player = player.getName();
|
|
||||||
this.elements = new ArrayList<Element>();
|
|
||||||
this.setAbilities(new HashMap<Integer, String>());
|
|
||||||
cooldowns = new ConcurrentHashMap<String, Long>();
|
|
||||||
this.permaRemoved = false;
|
|
||||||
isToggled = true;
|
|
||||||
blockedChi = false;
|
|
||||||
lastTime = System.currentTimeMillis();
|
|
||||||
|
|
||||||
players.put(player.getName(), this);
|
|
||||||
}
|
|
||||||
public BendingPlayer(UUID uuid) {
|
|
||||||
String playername = Bukkit.getOfflinePlayer(uuid).getName();
|
|
||||||
|
|
||||||
players.put(playername, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isOnCooldown(String ability) {
|
public boolean isOnCooldown(String ability) {
|
||||||
return this.cooldowns.containsKey(ability);
|
return this.cooldowns.containsKey(ability);
|
||||||
|
@ -140,61 +114,4 @@ public class BendingPlayer {
|
||||||
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot" + i + " = '" + (abilities.get(i) == null ? null: abilities.get(i)) + "' WHERE uuid = '" + uuid + "'");
|
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot" + i + " = '" + (abilities.get(i) == null ? null: abilities.get(i)) + "' WHERE uuid = '" + uuid + "'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BendingPlayer getBendingPlayer(Player player) {
|
|
||||||
if (players.containsKey(player.getName())) {
|
|
||||||
return players.get(player.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
BendingPlayer bPlayer = getPlayer(player.getUniqueId());
|
|
||||||
if (bPlayer != null) {
|
|
||||||
players.put(player.getName(), bPlayer);
|
|
||||||
return bPlayer;
|
|
||||||
} else {
|
|
||||||
return new BendingPlayer(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BendingPlayer getPlayer(UUID uuid) {
|
|
||||||
ResultSet rs2 = DBConnection.sql.readQuery("SELECT * FROM pk_players WHERE uuid = '" + uuid.toString() + "'");
|
|
||||||
try {
|
|
||||||
if (!rs2.next()) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
String name = rs2.getString("player");
|
|
||||||
String element = rs2.getString("element");
|
|
||||||
String permaremoved = rs2.getString("permaremoved");
|
|
||||||
boolean p = false;
|
|
||||||
ArrayList<Element> elements = new ArrayList<Element>();
|
|
||||||
if (element != null) { // Player has an element.
|
|
||||||
if (element.contains("a")) elements.add(Element.Air);
|
|
||||||
if (element.contains("w")) elements.add(Element.Water);
|
|
||||||
if (element.contains("e")) elements.add(Element.Earth);
|
|
||||||
if (element.contains("f")) elements.add(Element.Fire);
|
|
||||||
if (element.contains("c")) elements.add(Element.Chi);
|
|
||||||
}
|
|
||||||
|
|
||||||
HashMap<Integer, String> abilities = new HashMap<Integer, String>();
|
|
||||||
for (int i = 1; i <= 9; i++) {
|
|
||||||
String slot = rs2.getString("slot" + i);
|
|
||||||
if (slot != null) abilities.put(i, slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (permaremoved == null) {
|
|
||||||
p = false;
|
|
||||||
}
|
|
||||||
else if (permaremoved.equals("true")) {
|
|
||||||
p = true;
|
|
||||||
}
|
|
||||||
else if (permaremoved.equals("false")) {
|
|
||||||
p = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new BendingPlayer(uuid, name, elements, abilities, p);
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
package com.projectkorra.ProjectKorra;
|
|
||||||
|
|
||||||
public class PlayerSaver {
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in a new issue