mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-28 05:35:44 +01:00
Merge branch 'develop' of https://github.com/BentoBoxWorld/bentobox.git into develop
This commit is contained in:
commit
ad3d044e88
@ -109,7 +109,7 @@ public class MongoDBDatabaseHandler<T> extends AbstractJSONDatabaseHandler<T> {
|
||||
@Override
|
||||
public boolean deleteID(String uniqueId) {
|
||||
try {
|
||||
return collection.findOneAndDelete(new Document(MONGO_ID, uniqueId)) == null ? false : true;
|
||||
return collection.findOneAndDelete(new Document(MONGO_ID, uniqueId)) != null;
|
||||
} catch (Exception e) {
|
||||
plugin.logError("Could not delete object " + dataObject.getCanonicalName() + " " + uniqueId + " " + e.getMessage());
|
||||
return false;
|
||||
|
@ -9,13 +9,16 @@ import java.util.Set;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandMap;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||
|
||||
public class CommandsManager {
|
||||
|
||||
private Map<String, CompositeCommand> commands = new HashMap<>();
|
||||
@NonNull
|
||||
private Map<@NonNull String, @NonNull CompositeCommand> commands = new HashMap<>();
|
||||
|
||||
public void registerCommand(CompositeCommand command) {
|
||||
public void registerCommand(@NonNull CompositeCommand command) {
|
||||
commands.put(command.getLabel(), command);
|
||||
// Use reflection to obtain the commandMap method in Bukkit's server.
|
||||
try{
|
||||
@ -40,13 +43,15 @@ public class CommandsManager {
|
||||
* @param command - command string
|
||||
* @return CompositeCommand or null if it does not exist
|
||||
*/
|
||||
public CompositeCommand getCommand(String command) {
|
||||
@Nullable
|
||||
public CompositeCommand getCommand(@NonNull String command) {
|
||||
return commands.get(command);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the commands
|
||||
*/
|
||||
@NonNull
|
||||
public Map<String, CompositeCommand> getCommands() {
|
||||
return commands;
|
||||
}
|
||||
@ -55,8 +60,8 @@ public class CommandsManager {
|
||||
* List all commands registered so far
|
||||
* @return set of commands
|
||||
*/
|
||||
@NonNull
|
||||
public Set<String> listCommands() {
|
||||
return commands.keySet();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public class IslandDeletionManager implements Listener {
|
||||
public void onBentoBoxReady(BentoBoxReadyEvent e) {
|
||||
// Load list of islands that were mid deletion and delete them
|
||||
List<IslandDeletion> toBeDeleted = handler.loadObjects();
|
||||
if (toBeDeleted != null && toBeDeleted.size() > 0) {
|
||||
if (!toBeDeleted.isEmpty()) {
|
||||
plugin.log("There are " + toBeDeleted.size() + " islands pending deletion.");
|
||||
toBeDeleted.forEach(di -> {
|
||||
plugin.log("Resuming deletion of island at " + di.getLocation().getWorld().getName() + " " + Util.xyz(di.getLocation().toVector()));
|
||||
|
@ -78,6 +78,7 @@ public class Clipboard {
|
||||
private static final String ENTITY = "entity";
|
||||
private static final String COLOR = "color";
|
||||
private static final String LOAD_ERROR = "Could not load schems file - does not exist : ";
|
||||
private static final String LINES = "lines";
|
||||
|
||||
private YamlConfiguration blockConfig = new YamlConfiguration();
|
||||
private Location pos1;
|
||||
@ -234,7 +235,7 @@ public class Clipboard {
|
||||
count++;
|
||||
}
|
||||
while (it3 != null && pasteState.equals(PasteState.ENTITIES) && count < pasteSpeed && it3.hasNext()) {
|
||||
pasteEntity(world, island, loc, blockConfig.getConfigurationSection(ENTITIES_YAML_PREFIX + it3.next()));
|
||||
pasteEntity(world, loc, blockConfig.getConfigurationSection(ENTITIES_YAML_PREFIX + it3.next()));
|
||||
count++;
|
||||
}
|
||||
// STATE SHIFT
|
||||
@ -336,7 +337,7 @@ public class Clipboard {
|
||||
}
|
||||
}
|
||||
|
||||
private void pasteEntity(World world, Island island, Location location, ConfigurationSection config) {
|
||||
private void pasteEntity(World world, Location location, ConfigurationSection config) {
|
||||
String[] pos = config.getName().split(",");
|
||||
int x = location.getBlockX() + Integer.valueOf(pos[0]);
|
||||
int y = location.getBlockY() + Integer.valueOf(pos[1]);
|
||||
@ -403,7 +404,7 @@ public class Clipboard {
|
||||
BlockState bs = block.getState();
|
||||
// Signs
|
||||
if (bs instanceof Sign) {
|
||||
List<String> lines = config.getStringList("lines");
|
||||
List<String> lines = config.getStringList(LINES);
|
||||
writeSign(island, block, lines);
|
||||
}
|
||||
// Chests, in general
|
||||
@ -500,7 +501,7 @@ public class Clipboard {
|
||||
// Signs
|
||||
if (bs instanceof Sign) {
|
||||
Sign sign = (Sign)bs;
|
||||
a.set("lines", Arrays.asList(sign.getLines()));
|
||||
a.set(LINES, Arrays.asList(sign.getLines()));
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
@ -508,7 +509,7 @@ public class Clipboard {
|
||||
// Signs
|
||||
if (bs instanceof Sign) {
|
||||
Sign sign = (Sign)bs;
|
||||
s.set("lines", Arrays.asList(sign.getLines()));
|
||||
s.set(LINES, Arrays.asList(sign.getLines()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ public class DeleteIslandChunks {
|
||||
/**
|
||||
* This is how many chunks per world will be done in one tick.
|
||||
*/
|
||||
private final static int SPEED = 5;
|
||||
private static final int SPEED = 5;
|
||||
private int x;
|
||||
private int z;
|
||||
private BukkitTask task;
|
||||
|
Loading…
Reference in New Issue
Block a user