Retain cross-version compatibility & cleanup (#374)
This commit is contained in:
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
* Copyright (C) 2013 drtshock
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.drtshock.playervaults.vaultmanagement;
|
||||
|
||||
import com.drtshock.playervaults.PlayerVaults;
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
* Copyright (C) 2013 drtshock
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.drtshock.playervaults.vaultmanagement;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
@@ -27,13 +27,21 @@ import java.util.logging.Level;
|
||||
public class UUIDVaultManager {
|
||||
|
||||
private static UUIDVaultManager instance;
|
||||
private final File directory = PlayerVaults.getInstance().getUuidData();
|
||||
private final Map<String, YamlConfiguration> cachedVaultFiles = new ConcurrentHashMap<>();
|
||||
|
||||
public UUIDVaultManager() {
|
||||
instance = this;
|
||||
}
|
||||
|
||||
private final File directory = PlayerVaults.getInstance().getUuidData();
|
||||
private final Map<String, YamlConfiguration> cachedVaultFiles = new ConcurrentHashMap<>();
|
||||
/**
|
||||
* Get the instance of this class.
|
||||
*
|
||||
* @return - instance of this class.
|
||||
*/
|
||||
public static UUIDVaultManager getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the inventory to the specified player and vault number.
|
||||
@@ -251,9 +259,7 @@ public class UUIDVaultManager {
|
||||
}
|
||||
|
||||
public void removeCachedPlayerVaultFile(String holder) {
|
||||
if (cachedVaultFiles.containsKey(holder)) {
|
||||
cachedVaultFiles.remove(holder);
|
||||
}
|
||||
cachedVaultFiles.remove(holder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -318,13 +324,4 @@ public class UUIDVaultManager {
|
||||
PlayerVaults.getInstance().getLogger().log(Level.SEVERE, "Failed to save vault file for: " + holder, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the instance of this class.
|
||||
*
|
||||
* @return - instance of this class.
|
||||
*/
|
||||
public static UUIDVaultManager getInstance() {
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
* Copyright (C) 2013 drtshock
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.drtshock.playervaults.vaultmanagement;
|
||||
|
||||
import org.bukkit.inventory.Inventory;
|
||||
@@ -45,6 +29,11 @@ public class VaultHolder implements InventoryHolder {
|
||||
return vaultNumber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the inventory this vault holder holds
|
||||
*
|
||||
@@ -53,9 +42,4 @@ public class VaultHolder implements InventoryHolder {
|
||||
public void setInventory(Inventory inventory) {
|
||||
this.inventory = inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,15 +23,23 @@ import java.util.logging.Level;
|
||||
|
||||
public class VaultManager {
|
||||
|
||||
private static VaultManager instance;
|
||||
private static final String VAULTKEY = "vault%d";
|
||||
private static VaultManager instance;
|
||||
private final File directory = PlayerVaults.getInstance().getVaultData();
|
||||
private final Map<String, YamlConfiguration> cachedVaultFiles = new ConcurrentHashMap<>();
|
||||
|
||||
public VaultManager() {
|
||||
instance = this;
|
||||
}
|
||||
|
||||
private final File directory = PlayerVaults.getInstance().getVaultData();
|
||||
private final Map<String, YamlConfiguration> cachedVaultFiles = new ConcurrentHashMap<>();
|
||||
/**
|
||||
* Get the instance of this class.
|
||||
*
|
||||
* @return - instance of this class.
|
||||
*/
|
||||
public static VaultManager getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the inventory to the specified player and vault number.
|
||||
@@ -342,13 +350,4 @@ public class VaultManager {
|
||||
PlayerVaults.getInstance().getLogger().log(Level.SEVERE, "Failed to save vault file for: " + holder, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the instance of this class.
|
||||
*
|
||||
* @return - instance of this class.
|
||||
*/
|
||||
public static VaultManager getInstance() {
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
* Copyright (C) 2013 drtshock
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.drtshock.playervaults.vaultmanagement;
|
||||
|
||||
import com.drtshock.playervaults.PlayerVaults;
|
||||
@@ -72,11 +56,11 @@ public class VaultOperations {
|
||||
* @return Whether or not they have permission.
|
||||
*/
|
||||
public static boolean checkPerms(CommandSender sender, int number) {
|
||||
if (sender.hasPermission("playervaults.amount." + String.valueOf(number))) {
|
||||
if (sender.hasPermission("playervaults.amount." + number)) {
|
||||
return true;
|
||||
}
|
||||
for (int x = number; x <= 99; x++) {
|
||||
if (sender.hasPermission("playervaults.amount." + String.valueOf(x))) {
|
||||
if (sender.hasPermission("playervaults.amount." + x)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -319,7 +303,7 @@ public class VaultOperations {
|
||||
|
||||
if (sender.hasPermission("playervaults.delete.all")) {
|
||||
VaultManager.getInstance().deleteAllVaults(holder);
|
||||
PlayerVaults.getInstance().getLogger().info(String.format("%s deleted ALL vaults belonging to %s", sender.getName(), holder.toString()));
|
||||
PlayerVaults.getInstance().getLogger().info(String.format("%s deleted ALL vaults belonging to %s", sender.getName(), holder));
|
||||
} else {
|
||||
sender.sendMessage(Lang.TITLE.toString() + Lang.NO_PERMS);
|
||||
}
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
* Copyright (C) 2013 drtshock
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.drtshock.playervaults.vaultmanagement;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user