Merge pull request #6 from jacklin213/master

Merge pull requests from jacklin213
This commit is contained in:
MistPhizzle 2014-07-23 10:56:39 -04:00
commit ab9fa1b63c
6 changed files with 104 additions and 100 deletions

Binary file not shown.

View file

@ -1,6 +1,8 @@
package com.projectkorra.ProjectKorra; package com.projectkorra.ProjectKorra;
import java.io.File; import java.io.File;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
@ -77,8 +79,7 @@ public class Commands {
return true; return true;
} }
plugin.reloadConfig(); Methods.reloadPlugin();
Methods.stopBending();
s.sendMessage(ChatColor.AQUA + "Bending config reloaded."); s.sendMessage(ChatColor.AQUA + "Bending config reloaded.");
return true; return true;
} }
@ -228,6 +229,10 @@ public class Commands {
s.sendMessage(ChatColor.RED + "You don't have permission to do that."); s.sendMessage(ChatColor.RED + "You don't have permission to do that.");
return true; return true;
} }
if (Methods.isImportEnabled()) {
s.sendMessage(ChatColor.RED + "Importing has been disabled in the config");
return true;
}
s.sendMessage(ChatColor.GREEN + "Preparing data for import."); s.sendMessage(ChatColor.GREEN + "Preparing data for import.");
File bendingPlayersFile = new File(".", "converted.yml"); File bendingPlayersFile = new File(".", "converted.yml");
@ -269,7 +274,7 @@ public class Commands {
final CommandSender sender = s; final CommandSender sender = s;
s.sendMessage(ChatColor.GREEN + "Import of data started. Do NOT stop / reload your server."); s.sendMessage(ChatColor.GREEN + "Import of data started. Do NOT stop / reload your server.");
if (debug) { if (debug) {
s.sendMessage(ChatColor.RED + "Console will print out all of the players that are imported as they import."); s.sendMessage(ChatColor.RED + "Console will print out all of the players that are imported if debug mode is enabled as they import.");
} }
importTask = Bukkit.getServer().getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() { importTask = Bukkit.getServer().getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() {
public void run() { public void run() {
@ -283,6 +288,8 @@ public class Commands {
if (bPlayers.isEmpty()) { if (bPlayers.isEmpty()) {
sender.sendMessage(ChatColor.GREEN + "All data has been queued up, please allow up to 5 minutes for the data to complete, then reboot your server."); sender.sendMessage(ChatColor.GREEN + "All data has been queued up, please allow up to 5 minutes for the data to complete, then reboot your server.");
Bukkit.getServer().getScheduler().cancelTask(importTask.getTaskId()); Bukkit.getServer().getScheduler().cancelTask(importTask.getTaskId());
plugin.getConfig().set("Properties.ImportEnabled", false);
plugin.saveConfig();
for (Player player: Bukkit.getOnlinePlayers()) { for (Player player: Bukkit.getOnlinePlayers()) {
Methods.createBendingPlayer(player.getUniqueId(), player.getName()); Methods.createBendingPlayer(player.getUniqueId(), player.getName());
} }
@ -298,22 +305,25 @@ public class Commands {
HashMap<Integer, String> abilities = bPlayer.abilities; HashMap<Integer, String> abilities = bPlayer.abilities;
DBConnection.sql.modifyQuery("INSERT INTO pk_players (uuid, player, element, permaremoved) VALUES ('" + bPlayer.uuid.toString() + "', '" + bPlayer.player + "', '" + elements + "', '" + bPlayer.isPermaRemoved() +"')"); ResultSet rs2 = DBConnection.sql.readQuery("SELECT * FROM pk_players WHERE uuid = '" + bPlayer.uuid.toString() + "'");
for (int slot = 1; slot < 10; slot++) {
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot" + slot + " = '" + abilities.get(slot) + "' WHERE player = '" + bPlayer.getPlayerName() + "'");
}
// ResultSet rs2 = DBConnection.sql.readQuery("SELECT * FROM pk_players WHERE uuid = '" + bPlayer.uuid.toString() + "'");
// try { try {
// if (rs2.next()) { // SQL Data already exists for player. if (rs2.next()) { // SQL Data already exists for player.
// DBConnection.sql.modifyQuery("UPDATE pk_players SET player = '" + bPlayer.player + "' WHERE uuid = '" + bPlayer.uuid.toString()); DBConnection.sql.modifyQuery("UPDATE pk_players SET player = '" + bPlayer.player + "' WHERE uuid = '" + bPlayer.uuid.toString());
// DBConnection.sql.modifyQuery("UPDATE pk_players SET element = '" + elements + "' WHERE uuid = '" + bPlayer.uuid.toString()); DBConnection.sql.modifyQuery("UPDATE pk_players SET element = '" + elements + "' WHERE uuid = '" + bPlayer.uuid.toString());
// DBConnection.sql.modifyQuery("UPDATE pk_players SET permaremoved = 'false' WHERE uuid = '" + bPlayer.uuid.toString()); DBConnection.sql.modifyQuery("UPDATE pk_players SET permaremoved = '" + bPlayer.isPermaRemoved() + "' WHERE uuid = '" + bPlayer.uuid.toString());
// } else { for (int slot = 1; slot < 10; slot++) {
// } DBConnection.sql.modifyQuery("UPDATE pk_players SET slot" + slot + " = '" + abilities.get(slot) + "' WHERE player = '" + bPlayer.getPlayerName() + "'");
// } catch (SQLException ex) { }
// ex.printStackTrace(); } else {
// } DBConnection.sql.modifyQuery("INSERT INTO pk_players (uuid, player, element, permaremoved) VALUES ('" + bPlayer.uuid.toString() + "', '" + bPlayer.player + "', '" + elements + "', '" + bPlayer.isPermaRemoved() +"')");
for (int slot = 1; slot < 10; slot++) {
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot" + slot + " = '" + abilities.get(slot) + "' WHERE player = '" + bPlayer.getPlayerName() + "'");
}
}
} catch (SQLException ex) {
ex.printStackTrace();
}
i++; i++;
if (debug) { if (debug) {
System.out.println("[ProjectKorra] Successfully imported " + bPlayer.player + ". " + bPlayers.size() + " players left to import."); System.out.println("[ProjectKorra] Successfully imported " + bPlayer.player + ". " + bPlayers.size() + " players left to import.");
@ -401,6 +411,14 @@ public class Commands {
} }
} }
return true; return true;
} else {
s.sendMessage(ChatColor.RED + "Not a valid Element." + ChatColor.WHITE + " Elements: " +
Methods.getAirColor() + "Air" +
Methods.getEarthColor() + "Earth" +
Methods.getFireColor() + "Fire" +
Methods.getWaterColor() + "Water" +
Methods.getChiColor() + "Chi");
} }
} }
if (args.length == 1) { if (args.length == 1) {
@ -491,6 +509,14 @@ public class Commands {
if (Methods.isBender(un, Element.Chi)) { if (Methods.isBender(un, Element.Chi)) {
s.sendMessage(Methods.getChiColor() + "- ChiBlocker"); s.sendMessage(Methods.getChiColor() + "- ChiBlocker");
} }
BendingPlayer bPlayer = Methods.getBendingPlayer(un);
if (bPlayer != null) {
s.sendMessage("Abilities: ");
for (int i = 1; i <= 9; i++) {
String ability = bPlayer.getAbilities().get(i);
if (ability != null) s.sendMessage(i + " - " + Methods.getAbilityColor(ability) + ability);
}
}
return true; return true;
} }
if (args.length == 1) { if (args.length == 1) {
@ -816,6 +842,7 @@ public class Commands {
s.sendMessage(ChatColor.YELLOW + "/bending remove [Player]"); s.sendMessage(ChatColor.YELLOW + "/bending remove [Player]");
s.sendMessage(ChatColor.YELLOW + "/bending toggle"); s.sendMessage(ChatColor.YELLOW + "/bending toggle");
s.sendMessage(ChatColor.YELLOW + "/bending version"); s.sendMessage(ChatColor.YELLOW + "/bending version");
s.sendMessage(ChatColor.YELLOW + "/bending who");
return true; return true;
} }
if (!s.hasPermission("bending.command.help")) { if (!s.hasPermission("bending.command.help")) {

View file

@ -48,8 +48,9 @@ public class ConfigManager {
config.addDefault("Properties.Chat.Colors.Fire", "RED"); config.addDefault("Properties.Chat.Colors.Fire", "RED");
config.addDefault("Properties.Chat.Colors.Chi", "GOLD"); config.addDefault("Properties.Chat.Colors.Chi", "GOLD");
plugin.getConfig().addDefault("Properties.GlobalCooldown", 500); config.addDefault("Properties.ImportEnabled", true);
plugin.getConfig().addDefault("Properties.SeaLevel", 62); config.addDefault("Properties.GlobalCooldown", 500);
config.addDefault("Properties.SeaLevel", 62);
config.addDefault("Properties.CustomItems.GrapplingHook.Enable", true); config.addDefault("Properties.CustomItems.GrapplingHook.Enable", true);
config.addDefault("Properties.CustomItems.GrapplingHook.IronUses", 25); config.addDefault("Properties.CustomItems.GrapplingHook.IronUses", 25);
@ -62,25 +63,25 @@ public class ConfigManager {
config.addDefault("Properties.RegionProtection.RespectTowny", true); config.addDefault("Properties.RegionProtection.RespectTowny", true);
config.addDefault("Properties.RegionProtection.RespectPreciousStones", true); config.addDefault("Properties.RegionProtection.RespectPreciousStones", true);
plugin.getConfig().addDefault("Properties.Air.CanBendWithWeapons", false); config.addDefault("Properties.Air.CanBendWithWeapons", false);
plugin.getConfig().addDefault("Properties.Water.CanBendWithWeapons", true); config.addDefault("Properties.Water.CanBendWithWeapons", true);
plugin.getConfig().addDefault("Properties.Water.NightFactor", 1.5); config.addDefault("Properties.Water.NightFactor", 1.5);
config.addDefault("Properties.Water.FullMoonFactor", 3.0); config.addDefault("Properties.Water.FullMoonFactor", 3.0);
config.addDefault("Properties.Earth.RevertEarthbending", true); config.addDefault("Properties.Earth.RevertEarthbending", true);
config.addDefault("Properties.Earth.SafeRevert", true); config.addDefault("Properties.Earth.SafeRevert", true);
config.addDefault("Properties.Earth.RevertCheckTime", 300000); config.addDefault("Properties.Earth.RevertCheckTime", 300000);
plugin.getConfig().addDefault("Properties.Earth.CanBendWithWeapons", true); config.addDefault("Properties.Earth.CanBendWithWeapons", true);
plugin.getConfig().addDefault("Properties.Earth.EarthbendableBlocks", earthbendable); config.addDefault("Properties.Earth.EarthbendableBlocks", earthbendable);
plugin.getConfig().addDefault("Properties.Fire.CanBendWithWeapons", true); config.addDefault("Properties.Fire.CanBendWithWeapons", true);
plugin.getConfig().addDefault("Properties.Fire.DayFactor", 1.5); config.addDefault("Properties.Fire.DayFactor", 1.5);
plugin.getConfig().addDefault("Properties.Chi.CanBendWithWeapons", true); config.addDefault("Properties.Chi.CanBendWithWeapons", true);
plugin.getConfig().addDefault("Abilities.AvatarState.Enabled", true); config.addDefault("Abilities.AvatarState.Enabled", true);
plugin.getConfig().addDefault("Abilities.AvatarState.Description", "The signature ability of the Avatar, this is a toggle. Click to activate to become " config.addDefault("Abilities.AvatarState.Description", "The signature ability of the Avatar, this is a toggle. Click to activate to become "
+ "nearly unstoppable. While in the Avatar State, the user takes severely reduced damage from " + "nearly unstoppable. While in the Avatar State, the user takes severely reduced damage from "
+ "all sources, regenerates health rapidly, and is granted extreme speed. Nearly all abilities " + "all sources, regenerates health rapidly, and is granted extreme speed. Nearly all abilities "
+ "are incredibly amplified in this state. Additionally, AirShield and FireJet become toggle-able " + "are incredibly amplified in this state. Additionally, AirShield and FireJet become toggle-able "
@ -97,9 +98,9 @@ public class ConfigManager {
config.addDefault("Abilities.AvatarState.PotionEffects.FireResistance.Enabled", true); config.addDefault("Abilities.AvatarState.PotionEffects.FireResistance.Enabled", true);
config.addDefault("Abilities.AvatarState.PotionEffects.FireResistance.Power", 3); config.addDefault("Abilities.AvatarState.PotionEffects.FireResistance.Power", 3);
plugin.getConfig().addDefault("Abilities.Air.Passive.Factor", 0.3); config.addDefault("Abilities.Air.Passive.Factor", 0.3);
plugin.getConfig().addDefault("Abilities.Air.Passive.Speed", 2); config.addDefault("Abilities.Air.Passive.Speed", 2);
plugin.getConfig().addDefault("Abilities.Air.Passive.Jump", 3); config.addDefault("Abilities.Air.Passive.Jump", 3);
config.addDefault("Abilities.Air.AirBlast.Enabled", true); config.addDefault("Abilities.Air.AirBlast.Enabled", true);
config.addDefault("Abilities.Air.AirBlast.Description", "AirBlast is the most fundamental bending technique of an airbender." config.addDefault("Abilities.Air.AirBlast.Description", "AirBlast is the most fundamental bending technique of an airbender."
@ -133,8 +134,8 @@ public class ConfigManager {
+ "Any other actions will deactivate this ability."); + "Any other actions will deactivate this ability.");
config.addDefault("Abilities.Air.AirScooter.Speed", .675); config.addDefault("Abilities.Air.AirScooter.Speed", .675);
plugin.getConfig().addDefault("Abilities.Air.Tornado.Enabled", true); config.addDefault("Abilities.Air.Tornado.Enabled", true);
plugin.getConfig().addDefault("Abilities.Air.Tornado.Description", "To use, simply sneak (default: shift). " config.addDefault("Abilities.Air.Tornado.Description", "To use, simply sneak (default: shift). "
+ "This will create a swirling vortex at the targeted location. " + "This will create a swirling vortex at the targeted location. "
+ "Any creature or object caught in the vortex will be launched up " + "Any creature or object caught in the vortex will be launched up "
+ "and out in some random direction. If another player gets caught " + "and out in some random direction. If another player gets caught "
@ -186,7 +187,7 @@ public class ConfigManager {
config.addDefault("Abilities.Air.Tornado.MobPushFactor", 1); config.addDefault("Abilities.Air.Tornado.MobPushFactor", 1);
config.addDefault("Abilities.Air.Tornado.PlayerPushFactor", 1); config.addDefault("Abilities.Air.Tornado.PlayerPushFactor", 1);
plugin.getConfig().addDefault("Abilities.Water.Passive.SwimSpeedFactor", 0.7); config.addDefault("Abilities.Water.Passive.SwimSpeedFactor", 0.7);
config.addDefault("Abilities.Water.Bloodbending.Enabled", true); config.addDefault("Abilities.Water.Bloodbending.Enabled", true);
config.addDefault("Abilities.Water.Bloodbending.Description", "This ability was made illegal for a reason. With this ability selected, sneak while " config.addDefault("Abilities.Water.Bloodbending.Description", "This ability was made illegal for a reason. With this ability selected, sneak while "
@ -253,7 +254,7 @@ public class ConfigManager {
config.addDefault("Abilities.Water.Torrent.Enabled", true); config.addDefault("Abilities.Water.Torrent.Enabled", true);
config.addDefault("Abilities.Water.Torrent.Description", "Torrent is one of the strongest moves in a waterbender's arsenal. To use, first click a source block to select it; then hold shift to begin streaming the water around you. Water flowing around you this way will damage and knock back nearby enemies and projectiles. If you release shift during this, you will create a large wave that expands outwards from you, launching anything in its path back. Instead, if you click you release the water and channel it to flow towards your cursor. Anything caught in the blast will be tossed about violently and take damage. Finally, if you click again when the water is torrenting, it will freeze the area around it when it is obstructed."); config.addDefault("Abilities.Water.Torrent.Description", "Torrent is one of the strongest moves in a waterbender's arsenal. To use, first click a source block to select it; then hold shift to begin streaming the water around you. Water flowing around you this way will damage and knock back nearby enemies and projectiles. If you release shift during this, you will create a large wave that expands outwards from you, launching anything in its path back. Instead, if you click you release the water and channel it to flow towards your cursor. Anything caught in the blast will be tossed about violently and take damage. Finally, if you click again when the water is torrenting, it will freeze the area around it when it is obstructed.");
plugin.getConfig().addDefault("Abilities.Water.Plantbending.RegrowTime", 180000); config.addDefault("Abilities.Water.Plantbending.RegrowTime", 180000);
config.addDefault("Abilities.Water.WaterBubble.Enabled", true); config.addDefault("Abilities.Water.WaterBubble.Enabled", true);
config.addDefault("Abilities.Water.WaterBubble.Description","To use, the bender must merely have the ability selected. All water around the user in a small bubble will vanish, replacing itself once the user either gets too far away or selects a different ability."); config.addDefault("Abilities.Water.WaterBubble.Description","To use, the bender must merely have the ability selected. All water around the user in a small bubble will vanish, replacing itself once the user either gets too far away or selects a different ability.");
@ -267,7 +268,7 @@ public class ConfigManager {
+ "the spout will dissipate and you will fall. Click again with this ability selected to deactivate it."); + "the spout will dissipate and you will fall. Click again with this ability selected to deactivate it.");
config.addDefault("Abilities.Water.WaterSpout.Height", 20); config.addDefault("Abilities.Water.WaterSpout.Height", 20);
plugin.getConfig().addDefault("Abilities.Earth.Passive.Duration", 2500); config.addDefault("Abilities.Earth.Passive.Duration", 2500);
config.addDefault("Abilities.Earth.Catapult.Enabled", true); config.addDefault("Abilities.Earth.Catapult.Enabled", true);
config.addDefault("Abilities.Earth.Catapult.Description", "To use, left-click while looking in the direction you want to be launched. " config.addDefault("Abilities.Earth.Catapult.Description", "To use, left-click while looking in the direction you want to be launched. "
@ -450,9 +451,9 @@ public class ConfigManager {
config.addDefault("Abilities.Fire.WallOfFire.Cooldown", 500); config.addDefault("Abilities.Fire.WallOfFire.Cooldown", 500);
config.addDefault("Abilities.Fire.WallOfFire.Interval", 7500); config.addDefault("Abilities.Fire.WallOfFire.Interval", 7500);
plugin.getConfig().addDefault("Abilities.Chi.Passive.FallReductionFactor", 0.5); config.addDefault("Abilities.Chi.Passive.FallReductionFactor", 0.5);
plugin.getConfig().addDefault("Abilities.Chi.Passive.Speed", 1); config.addDefault("Abilities.Chi.Passive.Speed", 1);
plugin.getConfig().addDefault("Abilities.Chi.Passive.Jump", 2); config.addDefault("Abilities.Chi.Passive.Jump", 2);
config.addDefault("Abilities.Chi.Passive.BlockChi.Duration", 2500); config.addDefault("Abilities.Chi.Passive.BlockChi.Duration", 2500);
config.addDefault("Abilities.Chi.Passive.DodgeChange", 25); config.addDefault("Abilities.Chi.Passive.DodgeChange", 25);
@ -474,16 +475,16 @@ public class ConfigManager {
config.addDefault("Abilities.Chi.RapidPunch.Cooldown", 15000); config.addDefault("Abilities.Chi.RapidPunch.Cooldown", 15000);
config.addDefault("Abilities.Chi.RapidPunch.Punches", 4); config.addDefault("Abilities.Chi.RapidPunch.Punches", 4);
plugin.getConfig().addDefault("Storage.engine", "sqlite"); config.addDefault("Storage.engine", "sqlite");
plugin.getConfig().addDefault("Storage.MySQL.host", "localhost"); config.addDefault("Storage.MySQL.host", "localhost");
plugin.getConfig().addDefault("Storage.MySQL.port", 3306); config.addDefault("Storage.MySQL.port", 3306);
plugin.getConfig().addDefault("Storage.MySQL.pass", ""); config.addDefault("Storage.MySQL.pass", "");
plugin.getConfig().addDefault("Storage.MySQL.db", "minecraft"); config.addDefault("Storage.MySQL.db", "minecraft");
plugin.getConfig().addDefault("Storage.MySQL.user", "root"); config.addDefault("Storage.MySQL.user", "root");
config.addDefault("debug", false); config.addDefault("debug", false);
plugin.getConfig().options().copyDefaults(true); config.options().copyDefaults(true);
plugin.saveConfig(); plugin.saveConfig();
} }
} }

View file

@ -219,62 +219,15 @@ public class Methods {
if (bPlayer.hasElement(Element.Chi)) elements.append("c"); if (bPlayer.hasElement(Element.Chi)) elements.append("c");
HashMap<Integer, String> abilities = bPlayer.abilities; HashMap<Integer, String> abilities = bPlayer.abilities;
if (abilities.get(1) != null) { for (int i = 1; i <= 9; i++) {
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot1 = '" + abilities.get(1) + "' WHERE uuid = '" + uuid + "'"); DBConnection.sql.modifyQuery("UPDATE pk_players SET slot" + i +" = '" + (abilities.get(i) == null ? null : abilities.get(i)) + "' WHERE uuid = '" + uuid + "'");
} else {
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot1 = " + null + " WHERE uuid = '" + uuid + "'");
} }
if (abilities.get(2) != null) {
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot2 = '" + abilities.get(2) + "' WHERE uuid = '" + uuid + "'");
} else {
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot2 = " + null + " WHERE uuid = '" + uuid + "'");
}
if (abilities.get(3) != null) {
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot3 = '" + abilities.get(3) + "' WHERE uuid = '" + uuid + "'");
} else {
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot3 = " + null + " WHERE uuid = '" + uuid + "'");
}
if (abilities.get(4) != null) {
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot4 = '" + abilities.get(4) + "' WHERE uuid = '" + uuid + "'");
} else {
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot4 = " + null + " WHERE uuid = '" + uuid + "'");
}
if (abilities.get(5) != null) {
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot5 = '" + abilities.get(5) + "' WHERE uuid = '" + uuid + "'");
} else {
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot5 = " + null + " WHERE uuid = '" + uuid + "'");
}
if (abilities.get(6) != null) {
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot6 = '" + abilities.get(6) + "' WHERE uuid = '" + uuid + "'");
} else {
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot6 = " + null + " WHERE uuid = '" + uuid + "'");
}
if (abilities.get(7) != null) {
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot7 = '" + abilities.get(7) + "' WHERE uuid = '" + uuid + "'");
} else {
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot7 = " + null + " WHERE uuid = '" + uuid + "'");
}
if (abilities.get(8) != null) {
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot8 = '" + abilities.get(8) + "' WHERE uuid = '" + uuid + "'");
} else {
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot8 = " + null + " WHERE uuid = '" + uuid + "'");
}
if (abilities.get(9) != null) {
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot9 = '" + abilities.get(9) + "' WHERE uuid = '" + uuid + "'");
} else {
DBConnection.sql.modifyQuery("UPDATE pk_players SET slot9 = " + null + " WHERE uuid = '" + uuid + "'");
}
DBConnection.sql.modifyQuery("UPDATE pk_players SET element = '" + elements + "' WHERE uuid = '" + uuid + "'"); DBConnection.sql.modifyQuery("UPDATE pk_players SET element = '" + elements + "' WHERE uuid = '" + uuid + "'");
boolean permaRemoved = bPlayer.permaRemoved; boolean permaRemoved = bPlayer.permaRemoved;
if (permaRemoved) { DBConnection.sql.modifyQuery("UPDATE pk_players SET permaremoved = '" + (permaRemoved ? "true" : " false") +"' WHERE uuid = '" + uuid + "'");
DBConnection.sql.modifyQuery("UPDATE pk_players SET permaremoved = 'true' WHERE uuid = '" + uuid + "'");
} else {
DBConnection.sql.modifyQuery("UPDATE pk_players SET permaremoved = 'false' WHERE uuid = '" + uuid + "'");
}
} }
@ -1745,5 +1698,27 @@ public class Methods {
if (AbilityModuleManager.metalbendingabilities.contains(ability)) return true; if (AbilityModuleManager.metalbendingabilities.contains(ability)) return true;
return false; return false;
} }
public static boolean isImportEnabled() {
return plugin.getConfig().getBoolean("Properties.ImportEnabled");
}
public static void reloadPlugin() {
for (Player player: Bukkit.getOnlinePlayers()) {
Methods.saveBendingPlayer(player.getName());
}
DBConnection.sql.close();
plugin.reloadConfig();
Methods.stopBending();
DBConnection.host = plugin.getConfig().getString("Storage.MySQL.host");
DBConnection.port = plugin.getConfig().getInt("Storage.MySQL.port");
DBConnection.pass = plugin.getConfig().getString("Storage.MySQL.pass");
DBConnection.db = plugin.getConfig().getString("Storage.MySQL.db");
DBConnection.user = plugin.getConfig().getString("Storage.MySQL.user");
DBConnection.init();
for (Player player: Bukkit.getOnlinePlayers()) {
Methods.createBendingPlayer(player.getUniqueId(), player.getName());
}
}
} }

View file

@ -1,4 +1,5 @@
Properties: Properties:
ImportEnabled: true
GlobalCooldown: 500 GlobalCooldown: 500
SeaLevel: 62 SeaLevel: 62
CustomItems: CustomItems:

View file

@ -4,7 +4,7 @@ version: 1.3.0 BETA 2
main: com.projectkorra.ProjectKorra.ProjectKorra main: com.projectkorra.ProjectKorra.ProjectKorra
commands: commands:
projectkorra: projectkorra:
aliases: [b,bending,mtla,tla,korra,pk] aliases: [b,bending,mtla,tla,korra,pk,bend]
usage: /<command> usage: /<command>
permissions: permissions:
bending.admin: bending.admin: