Probably messed things up.
This commit is contained in:
@@ -1,15 +1,10 @@
|
|||||||
package me.shock.playervaults.commands;
|
package me.shock.playervaults.commands;
|
||||||
|
|
||||||
import me.shock.playervaults.Main;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class Feedback {
|
public class Feedback {
|
||||||
|
|
||||||
private static Main main;
|
|
||||||
static String pv = ChatColor.DARK_RED + "[" + ChatColor.WHITE + "PlayerVaults" +
|
static String pv = ChatColor.DARK_RED + "[" + ChatColor.WHITE + "PlayerVaults" +
|
||||||
ChatColor.DARK_RED + "]" + ChatColor.WHITE + ": ";
|
ChatColor.DARK_RED + "]" + ChatColor.WHITE + ": ";
|
||||||
|
|
||||||
@@ -28,12 +23,4 @@ public class Feedback {
|
|||||||
sender.sendMessage(pv + "You can't use this in that world!");
|
sender.sendMessage(pv + "You can't use this in that world!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static boolean allowedWorld(Player player) {
|
|
||||||
World world = player.getWorld();
|
|
||||||
if(main.disabledWorlds().contains(world))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,14 @@ import me.shock.playervaults.Main;
|
|||||||
import me.shock.playervaults.util.VaultManager;
|
import me.shock.playervaults.util.VaultManager;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class OwnVault {
|
public class OwnVault {
|
||||||
|
|
||||||
private static Main main;
|
private static Main plugin;
|
||||||
private static VaultManager vm = new VaultManager(main);
|
private static VaultManager vm = new VaultManager(plugin);
|
||||||
static Feedback feedback = new Feedback();
|
static Feedback feedback = new Feedback();
|
||||||
|
|
||||||
static String pv = ChatColor.DARK_RED + "[" + ChatColor.WHITE + "PlayerVaults" +
|
static String pv = ChatColor.DARK_RED + "[" + ChatColor.WHITE + "PlayerVaults" +
|
||||||
@@ -20,17 +21,22 @@ public class OwnVault {
|
|||||||
if(arg0.matches("^[0-9]{1,2}$")) {
|
if(arg0.matches("^[0-9]{1,2}$")) {
|
||||||
System.out.println("yay regex!");
|
System.out.println("yay regex!");
|
||||||
if(sender.hasPermission("playervaults.amount." + arg0)) {
|
if(sender.hasPermission("playervaults.amount." + arg0)) {
|
||||||
if(Feedback.allowedWorld((Player) sender)) {
|
|
||||||
int number = Integer.parseInt(arg0);
|
int number = Integer.parseInt(arg0);
|
||||||
vm.loadVault(sender, sender.getName(), number);
|
vm.loadVault(sender, sender.getName(), number);
|
||||||
sender.sendMessage(pv + "Opening vault " + ChatColor.GREEN + number);
|
sender.sendMessage(pv + "Opening vault " + ChatColor.GREEN + number);
|
||||||
return true;
|
return true;
|
||||||
} else
|
|
||||||
return false;
|
|
||||||
} else {
|
} else {
|
||||||
feedback.noPerms(sender);
|
feedback.noPerms(sender);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private static boolean allowedWorld(Player player) {
|
||||||
|
World world = player.getWorld();
|
||||||
|
if(plugin.disabledWorlds().contains(world))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,10 @@ public class VaultManager {
|
|||||||
YamlConfiguration file = playerVaultFile(player.getName());
|
YamlConfiguration file = playerVaultFile(player.getName());
|
||||||
System.out.println("serial: " + ser);
|
System.out.println("serial: " + ser);
|
||||||
// Prepare to save D:
|
// Prepare to save D:
|
||||||
|
file.createSection("vault" + number);
|
||||||
file.set("vault" + number + "", ser);
|
file.set("vault" + number + "", ser);
|
||||||
|
saveFile(player.getName());
|
||||||
|
Commands.inVault.remove(player.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,4 +100,11 @@ public class VaultManager {
|
|||||||
YamlConfiguration playerFile = YamlConfiguration.loadConfiguration(file);
|
YamlConfiguration playerFile = YamlConfiguration.loadConfiguration(file);
|
||||||
return playerFile;
|
return playerFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void saveFile(String name) throws IOException {
|
||||||
|
File file = new File(directory + File.separator + name.toLowerCase() + ".yml");
|
||||||
|
YamlConfiguration yaml = YamlConfiguration.loadConfiguration(file);
|
||||||
|
yaml.save(file);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user