mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-08-03 19:15:50 +00:00
Merge pull request #229 from jacklin213/bugfix
General Cleanup, Fix Update command
This commit is contained in:
commit
d23874f1e6
9 changed files with 21 additions and 23 deletions
|
@ -254,7 +254,7 @@ public class BendingPlayer {
|
|||
public void setAbilities(HashMap<Integer, String> abilities) {
|
||||
this.abilities = abilities;
|
||||
for (int i = 1; i <= 9; i++) {
|
||||
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) + "' WHERE uuid = '" + uuid + "'");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,6 @@ import com.projectkorra.projectkorra.firebending.FireBlast;
|
|||
import com.projectkorra.projectkorra.firebending.FireCombo;
|
||||
import com.projectkorra.projectkorra.firebending.FireMethods;
|
||||
import com.projectkorra.projectkorra.firebending.FireShield;
|
||||
import com.projectkorra.projectkorra.object.Preset;
|
||||
import com.projectkorra.projectkorra.storage.DBConnection;
|
||||
import com.projectkorra.projectkorra.util.Flight;
|
||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
||||
|
@ -448,7 +447,7 @@ public class GeneralMethods {
|
|||
for (int i = 1; i <= 9; i++) {
|
||||
String slot = rs2.getString("slot" + i);
|
||||
|
||||
if (slot != null) {
|
||||
if (slot != null && !slot.equalsIgnoreCase("null")) {
|
||||
abilities.put(i, slot);
|
||||
}
|
||||
}
|
||||
|
@ -1642,7 +1641,6 @@ public class GeneralMethods {
|
|||
}
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
GeneralMethods.createBendingPlayer(player.getUniqueId(), player.getName());
|
||||
Preset.loadPresets(player);
|
||||
}
|
||||
plugin.updater.checkUpdate();
|
||||
ProjectKorra.log.info("Reload complete");
|
||||
|
|
|
@ -11,7 +11,6 @@ import com.projectkorra.projectkorra.command.Commands;
|
|||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||
import com.projectkorra.projectkorra.earthbending.EarthbendingManager;
|
||||
import com.projectkorra.projectkorra.firebending.FirebendingManager;
|
||||
import com.projectkorra.projectkorra.object.Preset;
|
||||
import com.projectkorra.projectkorra.storage.DBConnection;
|
||||
import com.projectkorra.projectkorra.util.MetricsLite;
|
||||
import com.projectkorra.projectkorra.util.RevertChecker;
|
||||
|
@ -82,7 +81,6 @@ public class ProjectKorra extends JavaPlugin {
|
|||
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
GeneralMethods.createBendingPlayer(player.getUniqueId(), player.getName());
|
||||
Preset.loadPresets(player);
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
@ -27,7 +27,7 @@ public class CheckCommand extends PKCommand {
|
|||
if (ProjectKorra.plugin.updater.updateAvailable()) {
|
||||
sender.sendMessage(ChatColor.GREEN + "There is a new version of " + ChatColor.GOLD + "ProjectKorra" + ChatColor.GREEN + " available!");
|
||||
sender.sendMessage(ChatColor.YELLOW + "Current version: " + ChatColor.RED + ProjectKorra.plugin.updater.getCurrentVersion());
|
||||
sender.sendMessage(ChatColor.YELLOW + "Latest version: " + ChatColor.GOLD + ProjectKorra.plugin.updater.getCurrentVersion());
|
||||
sender.sendMessage(ChatColor.YELLOW + "Latest version: " + ChatColor.GOLD + ProjectKorra.plugin.updater.getUpdateVersion());
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.YELLOW + "You have the latest version of " + ChatColor.GOLD + "ProjectKorra");
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@ public class ImportCommand extends PKCommand {
|
|||
bPlayers.add(bPlayer);
|
||||
}
|
||||
|
||||
final CommandSender s = sender;
|
||||
final int total = bPlayers.size();
|
||||
sender.sendMessage(ChatColor.GREEN + "Import of data started. Do NOT stop / reload your server.");
|
||||
if (debugEnabled) {
|
||||
|
@ -91,13 +92,13 @@ public class ImportCommand extends PKCommand {
|
|||
public void run() {
|
||||
int i = 0;
|
||||
if (i >= 10) {
|
||||
sender.sendMessage(ChatColor.GREEN + "10 / " + total + " players converted thus far!");
|
||||
s.sendMessage(ChatColor.GREEN + "10 / " + total + " players converted thus far!");
|
||||
return;
|
||||
}
|
||||
|
||||
while (i < 10) {
|
||||
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.");
|
||||
s.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());
|
||||
ProjectKorra.plugin.getConfig().set("Properties.ImportEnabled", false);
|
||||
ProjectKorra.plugin.saveConfig();
|
||||
|
|
|
@ -6,17 +6,16 @@ import org.bukkit.entity.Player;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Abstract representation of a command executor. Implements
|
||||
* {@link PKCommandInterface}.
|
||||
* {@link SubCommand}.
|
||||
*
|
||||
* @author kingbirdy
|
||||
*
|
||||
*/
|
||||
public abstract class PKCommand implements PKCommandInterface {
|
||||
public abstract class PKCommand implements SubCommand {
|
||||
/**
|
||||
* The full name of the command.
|
||||
*/
|
||||
|
@ -65,8 +64,9 @@ public abstract class PKCommand implements PKCommandInterface {
|
|||
|
||||
public void help(CommandSender sender, boolean description) {
|
||||
sender.sendMessage(ChatColor.GOLD + "Proper Usage: " + ChatColor.DARK_AQUA + properUse);
|
||||
if (description)
|
||||
if (description) {
|
||||
sender.sendMessage(ChatColor.YELLOW + this.description);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,9 +78,9 @@ public abstract class PKCommand implements PKCommandInterface {
|
|||
* @return True if they have permission, false otherwise
|
||||
*/
|
||||
protected boolean hasPermission(CommandSender sender) {
|
||||
if (sender.hasPermission("bending.command." + name))
|
||||
if (sender.hasPermission("bending.command." + name)) {
|
||||
return true;
|
||||
else {
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "You don't have permission to do that.");
|
||||
return false;
|
||||
}
|
||||
|
@ -96,9 +96,9 @@ public abstract class PKCommand implements PKCommandInterface {
|
|||
* @return True if they have permission, false otherwise
|
||||
*/
|
||||
protected boolean hasPermission(CommandSender sender, String extra) {
|
||||
if (sender.hasPermission("bending.command." + name + "." + extra))
|
||||
if (sender.hasPermission("bending.command." + name + "." + extra)) {
|
||||
return true;
|
||||
else {
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "You don't have permission to do that.");
|
||||
return false;
|
||||
}
|
||||
|
@ -118,8 +118,9 @@ public abstract class PKCommand implements PKCommandInterface {
|
|||
if (size < min || size > max) {
|
||||
help(sender, false);
|
||||
return false;
|
||||
} else
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,9 +131,9 @@ public abstract class PKCommand implements PKCommandInterface {
|
|||
* @return True if sender instanceof Player, false otherwise
|
||||
*/
|
||||
protected boolean isPlayer(CommandSender sender) {
|
||||
if (sender instanceof Player)
|
||||
if (sender instanceof Player) {
|
||||
return true;
|
||||
else {
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "You must be a player to use that command.");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.util.List;
|
|||
/**
|
||||
* Interface representation of a command executor.
|
||||
*/
|
||||
public interface PKCommandInterface {
|
||||
public interface SubCommand {
|
||||
/**
|
||||
* Gets the name of the command.
|
||||
*
|
|
@ -122,7 +122,7 @@ public class WhoCommand extends PKCommand {
|
|||
* @param sender The CommandSender to display the information to
|
||||
* @param playerName The Player to look up
|
||||
*/
|
||||
private void whoPlayer(CommandSender sender, String playerName) {
|
||||
private void whoPlayer(final CommandSender sender, final String playerName) {
|
||||
Player player = Bukkit.getPlayer(playerName);
|
||||
if (player != null) {
|
||||
sender.sendMessage(playerName + " - ");
|
||||
|
|
|
@ -240,7 +240,7 @@ public class Preset {
|
|||
catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
for (Integer i : abilities.keySet()) {
|
||||
for (final Integer i : abilities.keySet()) {
|
||||
new BukkitRunnable() {
|
||||
PreparedStatement ps;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue