mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-09-11 04:39:32 +00:00
Merge pull request #362 from OmniCypher-/master
Various Fixes (read desc)
This commit is contained in:
commit
f37f03e25f
|
@ -5,10 +5,6 @@ import com.projectkorra.projectkorra.GeneralMethods;
|
|||
import com.projectkorra.projectkorra.ability.multiability.MultiAbilityManager;
|
||||
import com.projectkorra.projectkorra.object.Preset;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -167,30 +163,28 @@ public class PresetCommand extends PKCommand {
|
|||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "Player not found.");
|
||||
}
|
||||
} else if (Arrays.asList(createaliases).contains(args.get(0)) && hasPermission(sender, "create")) { //bending preset create name
|
||||
int limit = GeneralMethods.getMaxPresets(player);
|
||||
|
||||
if (Preset.presets.get(player) != null && Preset.presets.get(player).size() >= limit) {
|
||||
sender.sendMessage(ChatColor.RED + "You have reached your max number of Presets.");
|
||||
return;
|
||||
} else if (Preset.presetExists(player, name)) {
|
||||
sender.sendMessage(ChatColor.RED + "A preset with that name already exists.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (bPlayer == null) {
|
||||
return;
|
||||
}
|
||||
HashMap<Integer, String> abilities = (HashMap<Integer, String>) bPlayer.getAbilities().clone();
|
||||
|
||||
Preset preset = new Preset(player.getUniqueId(), name, abilities);
|
||||
preset.save(player);
|
||||
sender.sendMessage(ChatColor.GREEN + "Created preset with the name: " + ChatColor.YELLOW + name);
|
||||
} else {
|
||||
help(sender, false);
|
||||
}
|
||||
} else if (Arrays.asList(createaliases).contains(args.get(0)) && hasPermission(sender, "create")) { //bending preset create name
|
||||
int limit = GeneralMethods.getMaxPresets(player);
|
||||
|
||||
if (Preset.presets.get(player) != null && Preset.presets.get(player).size() >= limit) {
|
||||
sender.sendMessage(ChatColor.RED + "You have reached your max number of Presets.");
|
||||
return;
|
||||
} else if (Preset.presetExists(player, name)) {
|
||||
sender.sendMessage(ChatColor.RED + "A preset with that name already exists.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (bPlayer == null) {
|
||||
return;
|
||||
}
|
||||
HashMap<Integer, String> abilities = (HashMap<Integer, String>) bPlayer.getAbilities().clone();
|
||||
|
||||
Preset preset = new Preset(player.getUniqueId(), name, abilities);
|
||||
preset.save(player);
|
||||
sender.sendMessage(ChatColor.GREEN + "Created preset with the name: " + ChatColor.YELLOW + name);
|
||||
} else {
|
||||
help(sender, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ public class ConfigManager {
|
|||
config.addDefault("Properties.Water.NightFactor", 1.5);
|
||||
config.addDefault("Properties.Water.FullMoonFactor", 2.0);
|
||||
config.addDefault("Properties.Water.CanBendPackedIce", true);
|
||||
config.addDefault("Properties.Water.CanBendFromSpout", false);
|
||||
config.addDefault("Properties.Water.CanBendFromBentBlocks", false);
|
||||
config.addDefault("Properties.Water.PlaySound", true);
|
||||
config.addDefault("Properties.Water.NightMessage", "You feel the strength of the rising moon empowering your waterbending.");
|
||||
config.addDefault("Properties.Water.DayMessage", "You feel the empowering of your waterbending subside as the moon sets.");
|
||||
|
|
|
@ -7,6 +7,10 @@ import com.projectkorra.projectkorra.configuration.ConfigManager;
|
|||
import com.projectkorra.projectkorra.storage.DBConnection;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
@ -81,6 +85,7 @@ public class Preset {
|
|||
*/
|
||||
public static void loadPresets(final Player player) {
|
||||
new BukkitRunnable() {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void run() {
|
||||
UUID uuid = player.getUniqueId();
|
||||
|
@ -93,13 +98,13 @@ public class Preset {
|
|||
if (rs.next()) { // Presets exist.
|
||||
int i = 0;
|
||||
do {
|
||||
HashMap<Integer, String> moves = new HashMap<Integer, String>();
|
||||
HashMap<Integer, String> abilities = (HashMap<Integer, String>) new HashMap<Integer, String>().clone();
|
||||
for (int total = 1; total <= 9; total++) {
|
||||
String slot = rs.getString("slot" + total);
|
||||
if (slot != null)
|
||||
moves.put(total, slot);
|
||||
abilities.put(total, slot);
|
||||
}
|
||||
new Preset(uuid, rs.getString("name"), moves);
|
||||
new Preset(uuid, rs.getString("name"), abilities);
|
||||
i++;
|
||||
}
|
||||
while (rs.next());
|
||||
|
@ -230,12 +235,13 @@ public class Preset {
|
|||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static boolean bindExternalPreset(Player player, String name) {
|
||||
BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(player.getName());
|
||||
boolean boundAll = true;
|
||||
int slot = 0;
|
||||
|
||||
HashMap<Integer, String> abilities = new HashMap<Integer, String>();
|
||||
HashMap<Integer, String> abilities = (HashMap<Integer, String>) new HashMap<Integer, String>().clone();
|
||||
|
||||
if (externalPresetExists(name.toLowerCase())) {
|
||||
for (String ability : externalPresets.get(name.toLowerCase())) {
|
||||
|
|
|
@ -35,7 +35,7 @@ public class BlockSource {
|
|||
|
||||
public static List<Block> randomBlocks = new ArrayList<Block>();
|
||||
private static HashMap<Player, HashMap<BlockSourceType, HashMap<ClickType, BlockSourceInformation>>> playerSources = new HashMap<Player, HashMap<BlockSourceType, HashMap<ClickType, BlockSourceInformation>>>();
|
||||
private static final boolean spout = ProjectKorra.plugin.getConfig().getBoolean("Properties.Water.CanBendFromSpout");
|
||||
private static final boolean tempblock = ProjectKorra.plugin.getConfig().getBoolean("Properties.Water.CanBendFromBentBlocks");
|
||||
// The player should never need to grab source blocks from farther than this.
|
||||
|
||||
/**
|
||||
|
@ -229,7 +229,7 @@ public class BlockSource {
|
|||
sourceBlock = WaterMethods.getRandomWaterBlock(player, player.getLocation(), autoRange, water, ice, plant);
|
||||
}
|
||||
}
|
||||
if(sourceBlock != null && TempBlock.isTempBlock(sourceBlock) && spout) {
|
||||
if(sourceBlock != null && TempBlock.isTempBlock(sourceBlock) && !tempblock) {
|
||||
return null;
|
||||
}
|
||||
return sourceBlock;
|
||||
|
|
|
@ -227,7 +227,7 @@ public class WaterArmsSpear {
|
|||
}
|
||||
|
||||
private boolean canPlaceBlock(Block block) {
|
||||
if (!EarthMethods.isTransparentToEarthbending(player, block) && !((WaterMethods.isWater(block) || WaterMethods.isIcebendable(block)) && (TempBlock.isTempBlock(block) && !WaterArms.revert.containsKey(block)))) {
|
||||
if (!EarthMethods.isTransparentToEarthbending(player, block) && !WaterMethods.isWater(block) && (TempBlock.isTempBlock(block) && !WaterArms.revert.containsKey(block))) {
|
||||
return false;
|
||||
}
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(player, "WaterArms", block.getLocation())) {
|
||||
|
|
|
@ -419,7 +419,15 @@ public class WaterWave {
|
|||
return radius;
|
||||
}
|
||||
|
||||
public void setRadius(double radius) {
|
||||
public void setRadius(int range) {
|
||||
this.selectRange = range;
|
||||
}
|
||||
|
||||
public double getRange() {
|
||||
return selectRange;
|
||||
}
|
||||
|
||||
public void setRange(double radius) {
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue