Fix Javadocs and code issues.

Dieser Commit ist enthalten in:
sk89q 2014-07-29 11:04:04 -07:00
Ursprung 8834af7538
Commit 1dc84d2511
230 geänderte Dateien mit 1646 neuen und 1882 gelöschten Zeilen

Datei anzeigen

@ -36,22 +36,27 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
private final Map<String, Boolean> assignedPermissions = new HashMap<String, Boolean>();
@Override
public boolean isOp() {
return op;
}
@Override
public void setOp(boolean b) {
this.op = b;
}
@Override
public boolean isPermissionSet(String s) {
return assignedPermissions.containsKey(s.toLowerCase());
}
@Override
public boolean isPermissionSet(Permission permission) {
return isPermissionSet(permission.getName());
}
@Override
public boolean hasPermission(String s) {
if (isPermissionSet(s)) {
return assignedPermissions.get(s.toLowerCase());
@ -59,34 +64,42 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
return false;
}
@Override
public boolean hasPermission(Permission permission) {
return hasPermission(permission.getName());
}
@Override
public PermissionAttachment addAttachment(Plugin plugin, String s, boolean b) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public PermissionAttachment addAttachment(Plugin plugin) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public PermissionAttachment addAttachment(Plugin plugin, String s, boolean b, int i) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public PermissionAttachment addAttachment(Plugin plugin, int i) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void removeAttachment(PermissionAttachment permissionAttachment) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void recalculatePermissions() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Set<PermissionAttachmentInfo> getEffectivePermissions() {
Set<PermissionAttachmentInfo> ret = new HashSet<PermissionAttachmentInfo>();
for (Map.Entry<String, Boolean> entry : assignedPermissions.entrySet()) {
@ -109,10 +122,12 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
// -- Unneeded OfflinePlayer methods
@Override
public boolean isOnline() {
return false;
}
@Override
public String getName() {
return "Tester";
}
@ -121,42 +136,52 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
return randomUuid;
}
@Override
public boolean isBanned() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setBanned(boolean b) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean isWhitelisted() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setWhitelisted(boolean b) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Player getPlayer() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public long getFirstPlayed() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public long getLastPlayed() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean hasPlayedBefore() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Location getBedSpawnLocation() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Map<String, Object> serialize() {
throw new UnsupportedOperationException("Not supported yet.");
}

Datei anzeigen

@ -23,14 +23,13 @@ import com.sk89q.worldedit.util.TreeGenerator;
import org.junit.Assert;
import org.junit.Test;
/**
* @author zml2008
*/
public class BukkitWorldTest {
@Test
public void testTreeTypeMapping() {
for (TreeGenerator.TreeType type : TreeGenerator.TreeType.values()) {
Assert.assertFalse("No mapping for: " + type, BukkitWorld.toBukkitTreeType(type) == null);
}
}
}

Datei anzeigen

@ -19,10 +19,8 @@
package com.sk89q.bukkit.util;
/**
* @author zml2008
*/
public class CommandInfo {
private final String[] aliases;
private final Object registeredWith;
private final String usage, desc;
@ -63,4 +61,5 @@ public class CommandInfo {
public Object getRegisteredWith() {
return registeredWith;
}
}

Datei anzeigen

@ -19,12 +19,6 @@
package com.sk89q.bukkit.util;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.sk89q.util.ReflectionUtil;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandExecutor;
@ -32,9 +26,12 @@ import org.bukkit.command.CommandMap;
import org.bukkit.command.SimpleCommandMap;
import org.bukkit.plugin.Plugin;
/**
* @author zml2008
*/
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class CommandRegistration {
static {
@ -109,4 +106,5 @@ public class CommandRegistration {
}
return true;
}
}

Datei anzeigen

@ -31,10 +31,8 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @author zml2008
*/
public class CommandsManagerRegistration extends CommandRegistration {
protected CommandsManager<?> commands;
public CommandsManagerRegistration(Plugin plugin, CommandsManager<?> commands) {
@ -60,7 +58,7 @@ public class CommandsManagerRegistration extends CommandRegistration {
if (cmdMethod != null && cmdMethod.isAnnotationPresent(CommandPermissions.class)) {
permissions = Arrays.asList(cmdMethod.getAnnotation(CommandPermissions.class).value());
} else if (cmdMethod != null && childMethods != null && childMethods.size() > 0) {
} else if (cmdMethod != null && childMethods != null && !childMethods.isEmpty()) {
permissions = new ArrayList<String>();
for (Method m : childMethods.values()) {
if (m.isAnnotationPresent(CommandPermissions.class)) {
@ -74,4 +72,5 @@ public class CommandsManagerRegistration extends CommandRegistration {
return register(toRegister);
}
}

Datei anzeigen

@ -30,10 +30,8 @@ import org.bukkit.help.HelpTopicFactory;
import java.util.Map;
/**
* @author zml2008
*/
public class DynamicPluginCommandHelpTopic extends HelpTopic {
private final DynamicPluginCommand cmd;
public DynamicPluginCommandHelpTopic(DynamicPluginCommand cmd) {
@ -140,10 +138,10 @@ public class DynamicPluginCommandHelpTopic extends HelpTopic {
}
public static class Factory implements HelpTopicFactory<DynamicPluginCommand> {
@Override
public HelpTopic createTopic(DynamicPluginCommand command) {
return new DynamicPluginCommandHelpTopic(command);
}
}
}

Datei anzeigen

@ -24,9 +24,6 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
/**
* @author zml2008
*/
public class FallbackRegistrationListener implements Listener {
private final CommandMap commandRegistration;
@ -41,4 +38,5 @@ public class FallbackRegistrationListener implements Listener {
event.setCancelled(true);
}
}
}

Datei anzeigen

@ -50,6 +50,7 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver {
return section;
}
@Override
public void load() {
userGroups = new HashMap<String, Set<String>>();
userPermissionsCache = new HashMap<String, Set<String>>();
@ -64,7 +65,7 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver {
List<String> permissions =
config.getStringList("permissions.groups." + key + ".permissions", null);
if (permissions.size() > 0) {
if (!permissions.isEmpty()) {
Set<String> groupPerms = new HashSet<String>(permissions);
userGroupPermissions.put(key, groupPerms);
@ -84,7 +85,7 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver {
List<String> permissions =
config.getStringList("permissions.users." + key + ".permissions", null);
if (permissions.size() > 0) {
if (!permissions.isEmpty()) {
permsCache.addAll(permissions);
}
@ -92,7 +93,7 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver {
config.getStringList("permissions.users." + key + ".groups", null);
groups.add("default");
if (groups.size() > 0) {
if (!groups.isEmpty()) {
for (String group : groups) {
Set<String> groupPerms = userGroupPermissions.get(group);
if (groupPerms != null) {
@ -107,6 +108,7 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver {
}
}
@Override
public boolean hasPermission(String player, String permission) {
int dotPos = permission.lastIndexOf(".");
if (dotPos > -1) {
@ -124,11 +126,13 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver {
return perms.contains("*") || perms.contains(permission);
}
@Override
public boolean hasPermission(String worldName, String player, String permission) {
return hasPermission(player, "worlds." + worldName + "." + permission)
|| hasPermission(player, permission);
}
@Override
public boolean inGroup(String player, String group) {
Set<String> groups = userGroups.get(player.toLowerCase());
if (groups == null) {
@ -138,6 +142,7 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver {
return groups.contains(group);
}
@Override
public String[] getGroups(String player) {
Set<String> groups = userGroups.get(player.toLowerCase());
if (groups == null) {
@ -147,22 +152,27 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver {
return groups.toArray(new String[groups.size()]);
}
@Override
public boolean hasPermission(OfflinePlayer player, String permission) {
return hasPermission(player.getName(), permission);
}
@Override
public boolean hasPermission(String worldName, OfflinePlayer player, String permission) {
return hasPermission(worldName, player.getName(), permission);
}
@Override
public boolean inGroup(OfflinePlayer player, String group) {
return inGroup(player.getName(), group);
}
@Override
public String[] getGroups(OfflinePlayer player) {
return getGroups(player.getName());
}
@Override
public String getDetectionMessage() {
return "No known permissions plugin detected. Using configuration file for permissions.";
}

Datei anzeigen

@ -43,25 +43,31 @@ public class DinnerPermsResolver implements PermissionsResolver {
return new DinnerPermsResolver(server);
}
@Override
public void load() {
}
@Override
public boolean hasPermission(String name, String permission) {
return hasPermission(server.getOfflinePlayer(name), permission);
}
@Override
public boolean hasPermission(String worldName, String name, String permission) {
return hasPermission(worldName, server.getOfflinePlayer(name), permission);
}
@Override
public boolean inGroup(String name, String group) {
return inGroup(server.getOfflinePlayer(name), group);
}
@Override
public String[] getGroups(String name) {
return getGroups(server.getOfflinePlayer(name));
}
@Override
public boolean hasPermission(OfflinePlayer player, String permission) {
Permissible perms = getPermissible(player);
if (perms == null) {
@ -86,10 +92,12 @@ public class DinnerPermsResolver implements PermissionsResolver {
return internalHasPermission(perms, "*") == 1;
}
@Override
public boolean hasPermission(String worldName, OfflinePlayer player, String permission) {
return hasPermission(player, permission); // no per-world ability to check permissions in dinnerperms
}
@Override
public boolean inGroup(OfflinePlayer player, String group) {
final Permissible perms = getPermissible(player);
if (perms == null) {
@ -100,6 +108,7 @@ public class DinnerPermsResolver implements PermissionsResolver {
return perms.isPermissionSet(perm) && perms.hasPermission(perm);
}
@Override
public String[] getGroups(OfflinePlayer player) {
Permissible perms = getPermissible(player);
if (perms == null) {
@ -149,6 +158,7 @@ public class DinnerPermsResolver implements PermissionsResolver {
}
}
@Override
public String getDetectionMessage() {
return "Using the Bukkit Permissions API.";
}

Datei anzeigen

@ -19,27 +19,32 @@
package com.sk89q.wepif;
import com.sk89q.util.yaml.YAMLProcessor;
import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.HashMap;
import com.sk89q.util.yaml.YAMLProcessor;
import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
import java.util.logging.Level;
import java.util.logging.Logger;
public class FlatFilePermissionsResolver implements PermissionsResolver {
private static final Logger log = Logger.getLogger(FlatFilePermissionsResolver.class.getCanonicalName());
private Map<String, Set<String>> userPermissionsCache;
private Set<String> defaultPermissionsCache;
private Map<String, Set<String>> userGroups;
protected File groupFile;
protected File userFile;
private final File groupFile;
private final File userFile;
public static PermissionsResolver factory(Server server, YAMLProcessor config) {
File groups = new File("perms_groups.txt");
@ -80,7 +85,7 @@ public class FlatFilePermissionsResolver implements PermissionsResolver {
line = line.trim();
// Blank line
if (line.length() == 0) {
if (line.isEmpty()) {
continue;
} else if (line.charAt(0) == ';' || line.charAt(0) == '#') {
continue;
@ -98,19 +103,20 @@ public class FlatFilePermissionsResolver implements PermissionsResolver {
}
}
} catch (IOException e) {
e.printStackTrace();
log.log(Level.WARNING, "Failed to load permissions", e);
} finally {
try {
if (buff != null) {
buff.close();
}
} catch (IOException e2) {
} catch (IOException ignored) {
}
}
return userGroupPermissions;
}
@Override
public void load() {
userGroups = new HashMap<String, Set<String>>();
userPermissionsCache = new HashMap<String, Set<String>>();
@ -135,7 +141,7 @@ public class FlatFilePermissionsResolver implements PermissionsResolver {
line = line.trim();
// Blank line
if (line.length() == 0) {
if (line.isEmpty()) {
continue;
} else if (line.charAt(0) == ';' || line.charAt(0) == '#') {
continue;
@ -163,17 +169,18 @@ public class FlatFilePermissionsResolver implements PermissionsResolver {
}
}
} catch (IOException e) {
e.printStackTrace();
log.log(Level.WARNING, "Failed to load permissions", e);
} finally {
try {
if (buff != null) {
buff.close();
}
} catch (IOException e2) {
} catch (IOException ignored) {
}
}
}
@Override
public boolean hasPermission(String player, String permission) {
int dotPos = permission.lastIndexOf(".");
if (dotPos > -1) {
@ -191,20 +198,19 @@ public class FlatFilePermissionsResolver implements PermissionsResolver {
return perms.contains("*") || perms.contains(permission);
}
@Override
public boolean hasPermission(String worldName, String player, String permission) {
return hasPermission(player, "worlds." + worldName + "." + permission)
|| hasPermission(player, permission);
}
@Override
public boolean inGroup(String player, String group) {
Set<String> groups = userGroups.get(player.toLowerCase());
if (groups == null) {
return false;
}
return groups.contains(group);
return groups != null && groups.contains(group);
}
@Override
public String[] getGroups(String player) {
Set<String> groups = userGroups.get(player.toLowerCase());
if (groups == null) {
@ -214,22 +220,27 @@ public class FlatFilePermissionsResolver implements PermissionsResolver {
return groups.toArray(new String[groups.size()]);
}
@Override
public boolean hasPermission(OfflinePlayer player, String permission) {
return hasPermission(player.getName(), permission);
}
@Override
public boolean hasPermission(String worldName, OfflinePlayer player, String permission) {
return hasPermission(worldName, player.getName(), permission);
}
@Override
public boolean inGroup(OfflinePlayer player, String group) {
return inGroup(player.getName(), group);
}
@Override
public String[] getGroups(OfflinePlayer player) {
return getGroups(player.getName());
}
@Override
public String getDetectionMessage() {
return "perms_groups.txt and perms_users.txt detected! Using flat file permissions.";
}

Datei anzeigen

@ -50,6 +50,7 @@ public class GroupManagerResolver implements PermissionsResolver {
this.worldsHolder = worldsHolder;
}
@Override
public void load() {
}
@ -73,10 +74,12 @@ public class GroupManagerResolver implements PermissionsResolver {
}
}
@Override
public boolean hasPermission(String name, String permission) {
return hasPermission(null, name, permission);
}
@Override
public boolean hasPermission(String worldName, String name, String permission) {
if (permission == null || permission.isEmpty()) {
return false;
@ -88,6 +91,7 @@ public class GroupManagerResolver implements PermissionsResolver {
return permissionHandler.permission(name, permission);
}
@Override
public boolean inGroup(String name, String group) {
if (group == null || group.isEmpty()) {
return false;
@ -99,6 +103,7 @@ public class GroupManagerResolver implements PermissionsResolver {
return permissionHandler.inGroup(name, group);
}
@Override
public String[] getGroups(String name) {
AnjoPermissionsHandler permissionHandler = getPermissionHandler(name, null);
if (permissionHandler == null) {
@ -107,22 +112,27 @@ public class GroupManagerResolver implements PermissionsResolver {
return permissionHandler.getGroups(name);
}
@Override
public boolean hasPermission(OfflinePlayer player, String permission) {
return hasPermission(player.getName(), permission);
}
@Override
public boolean hasPermission(String worldName, OfflinePlayer player, String permission) {
return hasPermission(worldName, player.getName(), permission);
}
@Override
public boolean inGroup(OfflinePlayer player, String group) {
return inGroup(player.getName(), group);
}
@Override
public String[] getGroups(OfflinePlayer player) {
return getGroups(player.getName());
}
@Override
public String getDetectionMessage() {
return "GroupManager detected! Using GroupManager for permissions.";
}

Datei anzeigen

@ -29,7 +29,13 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import com.nijikokun.bukkit.Permissions.Permissions;
import java.util.logging.Level;
import java.util.logging.Logger;
public class NijiPermissionsResolver implements PermissionsResolver {
private static final Logger log = Logger.getLogger(NijiPermissionsResolver.class.getCanonicalName());
private Server server;
private Permissions api;
@ -56,6 +62,7 @@ public class NijiPermissionsResolver implements PermissionsResolver {
return new NijiPermissionsResolver(server, (Permissions) plugin);
}
@Override
public void load() {
}
@ -65,6 +72,7 @@ public class NijiPermissionsResolver implements PermissionsResolver {
this.api = plugin;
}
@Override
@SuppressWarnings("static-access")
public boolean hasPermission(String name, String permission) {
try {
@ -76,11 +84,12 @@ public class NijiPermissionsResolver implements PermissionsResolver {
return api.Security.permission(player, permission);
}
} catch (Throwable t) {
t.printStackTrace();
log.log(Level.WARNING, "Failed to check permissions", t);
return false;
}
}
@Override
public boolean hasPermission(String worldName, String name, String permission) {
try {
try {
@ -89,11 +98,12 @@ public class NijiPermissionsResolver implements PermissionsResolver {
return api.getHandler().has(server.getPlayerExact(name), permission);
}
} catch (Throwable t) {
t.printStackTrace();
log.log(Level.WARNING, "Failed to check permissions", t);
return false;
}
}
@Override
@SuppressWarnings("static-access")
public boolean inGroup(String name, String group) {
try {
@ -105,11 +115,12 @@ public class NijiPermissionsResolver implements PermissionsResolver {
return api.Security.inGroup(name, group);
}
} catch (Throwable t) {
t.printStackTrace();
log.log(Level.WARNING, "Failed to check groups", t);
return false;
}
}
@Override
@SuppressWarnings("static-access")
public String[] getGroups(String name) {
try {
@ -128,23 +139,27 @@ public class NijiPermissionsResolver implements PermissionsResolver {
return groups;
}
} catch (Throwable t) {
t.printStackTrace();
log.log(Level.WARNING, "Failed to get groups", t);
return new String[0];
}
}
@Override
public boolean hasPermission(OfflinePlayer player, String permission) {
return hasPermission(player.getName(), permission);
}
@Override
public boolean hasPermission(String worldName, OfflinePlayer player, String permission) {
return hasPermission(worldName, player.getName(), permission);
}
@Override
public boolean inGroup(OfflinePlayer player, String group) {
return inGroup(player.getName(), group);
}
@Override
public String[] getGroups(OfflinePlayer player) {
return getGroups(player.getName());
}
@ -155,7 +170,9 @@ public class NijiPermissionsResolver implements PermissionsResolver {
return permsCommand == null || !(permsCommand.getPlugin().equals(plugin));
}
@Override
public String getDetectionMessage() {
return "Permissions plugin detected! Using Permissions plugin for permissions.";
}
}

Datei anzeigen

@ -48,10 +48,12 @@ public class PermissionsExResolver extends DinnerPermsResolver {
this.manager = manager;
}
@Override
public boolean hasPermission(String worldName, String name, String permission) {
return manager.has(name, permission, worldName);
}
@Override
public boolean hasPermission(OfflinePlayer player, String permission) {
Permissible permissible = getPermissible(player);
if (permissible == null) {
@ -61,14 +63,17 @@ public class PermissionsExResolver extends DinnerPermsResolver {
}
}
@Override
public boolean hasPermission(String worldName, OfflinePlayer player, String permission) {
return hasPermission(worldName, player.getName(), permission);
}
@Override
public boolean inGroup(OfflinePlayer player, String group) {
return super.inGroup(player, group) || manager.getUser(player.getName()).inGroup(group);
}
@Override
public String[] getGroups(OfflinePlayer player) {
if (getPermissible(player) == null) {
PermissionUser user = manager.getUser(player.getName());
@ -81,6 +86,7 @@ public class PermissionsExResolver extends DinnerPermsResolver {
}
}
@Override
public String getDetectionMessage() {
return "PermissionsEx detected! Using PermissionsEx for permissions.";
}

Datei anzeigen

@ -35,9 +35,11 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
public class PermissionsResolverManager implements PermissionsResolver {
private static final String CONFIG_HEADER = "#\r\n" +
"# WEPIF Configuration File\r\n" +
"#\r\n" +
@ -116,8 +118,7 @@ public class PermissionsResolverManager implements PermissionsResolver {
break;
}
} catch (Throwable e) {
logger.warning("Error in factory method for " + resolverClass.getSimpleName() + ": " + e);
e.printStackTrace();
logger.log(Level.WARNING, "Error in factory method for " + resolverClass.getSimpleName(), e);
continue;
}
}
@ -137,42 +138,52 @@ public class PermissionsResolverManager implements PermissionsResolver {
logger.info("WEPIF: " + permissionResolver.getDetectionMessage());
}
@Override
public void load() {
findResolver();
}
@Override
public boolean hasPermission(String name, String permission) {
return permissionResolver.hasPermission(name, permission);
}
@Override
public boolean hasPermission(String worldName, String name, String permission) {
return permissionResolver.hasPermission(worldName, name, permission);
}
@Override
public boolean inGroup(String player, String group) {
return permissionResolver.inGroup(player, group);
}
@Override
public String[] getGroups(String player) {
return permissionResolver.getGroups(player);
}
@Override
public boolean hasPermission(OfflinePlayer player, String permission) {
return permissionResolver.hasPermission(player, permission);
}
@Override
public boolean hasPermission(String worldName, OfflinePlayer player, String permission) {
return permissionResolver.hasPermission(worldName, player, permission);
}
@Override
public boolean inGroup(OfflinePlayer player, String group) {
return permissionResolver.inGroup(player, group);
}
@Override
public String[] getGroups(OfflinePlayer player) {
return permissionResolver.getGroups(player);
}
@Override
public String getDetectionMessage() {
return "Using WEPIF for permissions";
}
@ -183,15 +194,14 @@ public class PermissionsResolverManager implements PermissionsResolver {
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
logger.log(Level.WARNING, "Failed to create new configuration file", e);
}
}
config = new YAMLProcessor(file, false, YAMLFormat.EXTENDED);
try {
config.load();
} catch (IOException e) {
logger.severe("Error loading WEPIF Config: " + e);
e.printStackTrace();
logger.log(Level.WARNING, "Error loading WEPIF configuration", e);
}
List<String> keys = config.getKeys(null);
config.setHeader(CONFIG_HEADER);
@ -263,7 +273,6 @@ public class PermissionsResolverManager implements PermissionsResolver {
}
public static class MissingPluginException extends Exception {
private static final long serialVersionUID = 7044832912491608706L;
}
class ServerListener implements org.bukkit.event.Listener {

Datei anzeigen

@ -53,41 +53,51 @@ public class PluginPermissionsResolver implements PermissionsResolver {
this.plugin = permissionsPlugin;
}
@Override
public void load() {
}
@Override
public boolean hasPermission(String name, String permission) {
return resolver.hasPermission(name, permission);
}
@Override
public boolean hasPermission(String worldName, String name, String permission) {
return resolver.hasPermission(worldName, name, permission);
}
@Override
public boolean inGroup(String player, String group) {
return resolver.inGroup(player, group);
}
@Override
public String[] getGroups(String player) {
return resolver.getGroups(player);
}
@Override
public boolean hasPermission(OfflinePlayer player, String permission) {
return resolver.hasPermission(player, permission);
}
@Override
public boolean hasPermission(String worldName, OfflinePlayer player, String permission) {
return resolver.hasPermission(worldName, player, permission);
}
@Override
public boolean inGroup(OfflinePlayer player, String group) {
return resolver.inGroup(player, group);
}
@Override
public String[] getGroups(OfflinePlayer player) {
return resolver.getGroups(player);
}
@Override
public String getDetectionMessage() {
return "Using plugin '" + this.plugin.getDescription().getName() + "' for permissions.";
}

Datei anzeigen

@ -19,13 +19,10 @@
package com.sk89q.wepif;
/**
* @author zml2008
*/
public class WEPIFRuntimeException extends RuntimeException {
private static final long serialVersionUID = 5092745960439109699L;
public WEPIFRuntimeException(String message) {
super(message);
}
}

Datei anzeigen

@ -26,9 +26,6 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
import org.bukkit.entity.Player;
/**
* @author zml2008
*/
public class bPermissionsResolver implements PermissionsResolver {
public static PermissionsResolver factory(Server server, YAMLProcessor config) {
@ -47,29 +44,36 @@ public class bPermissionsResolver implements PermissionsResolver {
this.server = server;
}
@Override
public void load() {
}
@Override
public String getDetectionMessage() {
return "bPermissions detected! Using bPermissions for permissions";
}
@Override
public boolean hasPermission(String name, String permission) {
return hasPermission(server.getOfflinePlayer(name), permission);
}
@Override
public boolean hasPermission(String worldName, String name, String permission) {
return ApiLayer.hasPermission(worldName, CalculableType.USER, name, permission);
}
@Override
public boolean inGroup(String player, String group) {
return inGroup(server.getOfflinePlayer(player), group);
}
@Override
public String[] getGroups(String player) {
return getGroups(server.getOfflinePlayer(player));
}
@Override
public boolean hasPermission(OfflinePlayer player, String permission) {
Player onlinePlayer = player.getPlayer();
if (onlinePlayer == null) {
@ -79,10 +83,12 @@ public class bPermissionsResolver implements PermissionsResolver {
}
}
@Override
public boolean hasPermission(String worldName, OfflinePlayer player, String permission) {
return hasPermission(worldName, player.getName(), permission);
}
@Override
public boolean inGroup(OfflinePlayer player, String group) {
Player onlinePlayer = player.getPlayer();
if (onlinePlayer == null) {
@ -92,6 +98,7 @@ public class bPermissionsResolver implements PermissionsResolver {
}
}
@Override
public String[] getGroups(OfflinePlayer player) {
Player onlinePlayer = player.getPlayer();
if (onlinePlayer == null) {
@ -100,4 +107,5 @@ public class bPermissionsResolver implements PermissionsResolver {
return ApiLayer.getGroups(onlinePlayer.getWorld().getName(), CalculableType.USER, player.getName());
}
}
}

Datei anzeigen

@ -29,19 +29,14 @@ import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.blocks.ItemType;
public class BukkitPlayerBlockBag extends BlockBag {
/**
* Player instance.
*/
private Player player;
/**
* The player's inventory;
*/
private ItemStack[] items;
/**
* Construct the object.
*
* @param player
* @param player the player
*/
public BukkitPlayerBlockBag(Player player) {
this.player = player;
@ -59,17 +54,12 @@ public class BukkitPlayerBlockBag extends BlockBag {
/**
* Get the player.
*
* @return
* @return the player
*/
public Player getPlayer() {
return player;
}
/**
* Get a block.
*
* @param id
*/
@Override
public void fetchItem(BaseItem item) throws BlockBagException {
final int id = item.getType();
@ -125,11 +115,6 @@ public class BukkitPlayerBlockBag extends BlockBag {
}
}
/**
* Store a block.
*
* @param id
*/
@Override
public void storeItem(BaseItem item) throws BlockBagException {
final int id = item.getType();
@ -197,9 +182,6 @@ public class BukkitPlayerBlockBag extends BlockBag {
throw new OutOfSpaceException(id);
}
/**
* Flush any changes. This is called at the end.
*/
@Override
public void flushChanges() {
if (items != null) {
@ -208,21 +190,12 @@ public class BukkitPlayerBlockBag extends BlockBag {
}
}
/**
* Adds a position to be used a source.
*
* @param pos
*/
@Override
public void addSourcePosition(WorldVector pos) {
}
/**
* Adds a position to be used a source.
*
* @param pos
*/
@Override
public void addSingleSourcePosition(WorldVector pos) {
}
}

Datei anzeigen

@ -26,10 +26,10 @@ import org.bukkit.plugin.messaging.PluginMessageListener;
import java.nio.charset.Charset;
/**
* Handles incoming WorldEditCui init message
* @author zml2008
* Handles incoming WorldEditCui init message.
*/
public class CUIChannelListener implements PluginMessageListener {
public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8");
private final WorldEditPlugin plugin;
@ -44,4 +44,5 @@ public class CUIChannelListener implements PluginMessageListener {
session.handleCUIInitializationMessage(text);
session.describeCUI(plugin.wrapPlayer(player));
}
}

Datei anzeigen

@ -28,16 +28,16 @@ import com.sk89q.worldedit.blocks.BaseBlock;
/**
* Proxy class to catch calls to set blocks.
*
* @author sk89q
*/
public class EditSessionBlockChangeDelegate implements BlockChangeDelegate {
private EditSession editSession;
public EditSessionBlockChangeDelegate(EditSession editSession) {
this.editSession = editSession;
}
@Override
public boolean setRawTypeId(int x, int y, int z, int typeId) {
try {
return editSession.setBlock(new Vector(x, y, z), new BaseBlock(typeId));
@ -46,6 +46,7 @@ public class EditSessionBlockChangeDelegate implements BlockChangeDelegate {
}
}
@Override
public boolean setRawTypeIdAndData(int x, int y, int z, int typeId, int data) {
try {
return editSession.setBlock(new Vector(x, y, z), new BaseBlock(typeId, data));
@ -54,23 +55,29 @@ public class EditSessionBlockChangeDelegate implements BlockChangeDelegate {
}
}
@Override
public boolean setTypeId(int x, int y, int z, int typeId) {
return setRawTypeId(x, y, z, typeId);
}
@Override
public boolean setTypeIdAndData(int x, int y, int z, int typeId, int data) {
return setRawTypeIdAndData(x, y, z, typeId, data);
}
@Override
public int getTypeId(int x, int y, int z) {
return editSession.getBlockType(new Vector(x, y, z));
}
@Override
public int getHeight() {
return editSession.getWorld().getMaxY() + 1;
}
@Override
public boolean isEmpty(int x, int y, int z) {
return editSession.getBlockType(new Vector(x, y, z)) == BlockID.AIR;
}
}

Datei anzeigen

@ -22,7 +22,12 @@ package com.sk89q.worldedit.bukkit;
import org.bukkit.entity.Player;
import com.sk89q.worldedit.LocalSession;
/**
* @deprecated use the regular API
*/
@Deprecated
public class WorldEditAPI {
private WorldEditPlugin plugin;
public WorldEditAPI(WorldEditPlugin plugin) {
@ -32,11 +37,12 @@ public class WorldEditAPI {
/**
* Get the session for a player.
*
* @param player
* @return
* @param player the player
* @return a session
*/
public LocalSession getSession(Player player) {
return plugin.getWorldEdit().getSession(
new BukkitPlayer(plugin, plugin.getServerInterface(), player));
}
}

Datei anzeigen

@ -55,7 +55,7 @@ public class WorldEditListener implements Listener {
/**
* Construct the object;
*
* @param plugin
* @param plugin the plugin
*/
public WorldEditListener(WorldEditPlugin plugin) {
this.plugin = plugin;
@ -67,7 +67,7 @@ public class WorldEditListener implements Listener {
return;
}
// this will automatically refresh their sesssion, we don't have to do anything
// this will automatically refresh their session, we don't have to do anything
WorldEdit.getInstance().getSession(plugin.wrapPlayer(event.getPlayer()));
}

Datei anzeigen

@ -71,9 +71,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
/**
* Plugin for Bukkit.
*
* @author sk89q
*/
@SuppressWarnings("deprecation")
public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
private static final Logger log = Logger.getLogger(WorldEditPlugin.class.getCanonicalName());
@ -88,10 +87,12 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
/**
* Called on plugin enable.
*/
@SuppressWarnings("AccessStaticViaInstance")
@Override
public void onEnable() {
this.INSTANCE = this;
//noinspection ResultOfMethodCallIgnored
getDataFolder().mkdirs();
WorldEdit worldEdit = WorldEdit.getInstance();
@ -191,8 +192,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
protected void createDefaultConfiguration(String name) {
File actual = new File(getDataFolder(), name);
if (!actual.exists()) {
InputStream input =
null;
InputStream input = null;
try {
JarFile file = new JarFile(getFile());
ZipEntry copy = file.getEntry("defaults/" + name);
@ -207,26 +207,24 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
try {
output = new FileOutputStream(actual);
byte[] buf = new byte[8192];
int length = 0;
int length;
while ((length = input.read(buf)) > 0) {
output.write(buf, 0, length);
}
getLogger().info("Default configuration file written: " + name);
} catch (IOException e) {
e.printStackTrace();
getLogger().log(Level.WARNING, "Failed to write default config file", e);
} finally {
try {
if (input != null) {
input.close();
}
} catch (IOException e) {}
input.close();
} catch (IOException ignored) {}
try {
if (output != null) {
output.close();
}
} catch (IOException e) {}
} catch (IOException ignored) {}
}
}
}
@ -262,8 +260,8 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
/**
* Gets the session for the player.
*
* @param player
* @return
* @param player a player
* @return a session
*/
public LocalSession getSession(Player player) {
return WorldEdit.getInstance().getSession(wrapPlayer(player));
@ -272,8 +270,8 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
/**
* Gets the session for the player.
*
* @param player
* @return
* @param player a player
* @return a session
*/
public EditSession createEditSession(Player player) {
LocalPlayer wePlayer = wrapPlayer(player);
@ -290,8 +288,8 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
/**
* Remember an edit session.
*
* @param player
* @param editSession
* @param player a player
* @param editSession an edit session
*/
public void remember(Player player, EditSession editSession) {
LocalPlayer wePlayer = wrapPlayer(player);
@ -306,10 +304,12 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
/**
* Wrap an operation into an EditSession.
*
* @param player
* @param op
* @throws Throwable
* @param player a player
* @param op the operation
* @throws Throwable on any error
* @deprecated use the regular API
*/
@Deprecated
public void perform(Player player, WorldEditOperation op) throws Throwable {
LocalPlayer wePlayer = wrapPlayer(player);
LocalSession session = WorldEdit.getInstance().getSession(wePlayer);
@ -325,7 +325,8 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
/**
* Get the API.
*
* @return
* @return the API
* @deprecated use the regular API
*/
@Deprecated
public WorldEditAPI getAPI() {
@ -335,7 +336,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
/**
* Returns the configuration used by WorldEdit.
*
* @return
* @return the configuration
*/
public BukkitConfiguration getLocalConfiguration() {
return config;
@ -344,7 +345,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
/**
* Get the permissions resolver in use.
*
* @return
* @return the permissions resolver
*/
public PermissionsResolverManager getPermissionsResolver() {
return PermissionsResolverManager.getInstance();
@ -353,8 +354,8 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
/**
* Used to wrap a Bukkit Player as a LocalPlayer.
*
* @param player
* @return
* @param player a player
* @return a wrapped player
*/
public BukkitPlayer wrapPlayer(Player player) {
return new BukkitPlayer(this, this.server, player);
@ -371,7 +372,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
/**
* Get the server interface.
*
* @return
* @return the server interface
*/
public ServerInterface getServerInterface() {
return server;
@ -384,7 +385,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
/**
* Get WorldEdit.
*
* @return
* @return an instance
*/
public WorldEdit getWorldEdit() {
return WorldEdit.getInstance();
@ -393,7 +394,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
/**
* Gets the region selection for the player.
*
* @param player
* @param player aplayer
* @return the selection or null if there was none
*/
public Selection getSelection(Player player) {
@ -428,8 +429,8 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
/**
* Sets the region selection for a player.
*
* @param player
* @param selection
* @param player the player
* @param selection a selection
*/
public void setSelection(Player player, Selection selection) {
if (player == null) {

Datei anzeigen

@ -26,10 +26,8 @@ import org.bukkit.entity.EntityType;
import java.util.UUID;
/**
* @author zml2008
*/
public class BukkitEntity extends LocalEntity {
private final EntityType type;
private final UUID entityId;
@ -48,4 +46,5 @@ public class BukkitEntity extends LocalEntity {
org.bukkit.Location loc = BukkitUtil.toLocation(weLoc);
return loc.getWorld().spawn(loc, type.getEntityClass()) != null;
}
}

Datei anzeigen

@ -26,10 +26,8 @@ import org.bukkit.entity.ExperienceOrb;
import java.util.UUID;
/**
* @author zml2008
*/
public class BukkitExpOrb extends BukkitEntity {
private final int amount;
public BukkitExpOrb(Location loc, UUID entityId, int amount) {
@ -47,4 +45,5 @@ public class BukkitExpOrb extends BukkitEntity {
}
return false;
}
}

Datei anzeigen

@ -26,10 +26,8 @@ import org.bukkit.inventory.ItemStack;
import java.util.UUID;
/**
* @author zml2008
*/
public class BukkitItem extends BukkitEntity {
private final ItemStack stack;
public BukkitItem(Location loc, ItemStack stack, UUID entityId) {
super(loc, EntityType.DROPPED_ITEM, entityId);
@ -41,4 +39,5 @@ public class BukkitItem extends BukkitEntity {
org.bukkit.Location loc = BukkitUtil.toLocation(weLoc);
return loc.getWorld().dropItem(loc, stack) != null;
}
}

Datei anzeigen

@ -30,18 +30,20 @@ import org.bukkit.entity.Painting;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* @author zml2008
*/
public class BukkitPainting extends BukkitEntity {
private static final Logger log = Logger.getLogger(BukkitPainting.class.getCanonicalName());
private static int spawnTask = -1;
private static final Deque<QueuedPaintingSpawn> spawnQueue = new ArrayDeque<QueuedPaintingSpawn>();
private class QueuedPaintingSpawn {
private final Location weLoc;
public QueuedPaintingSpawn(Location weLoc) {
private QueuedPaintingSpawn(Location weLoc) {
this.weLoc = weLoc;
}
@ -49,6 +51,7 @@ public class BukkitPainting extends BukkitEntity {
spawnRaw(weLoc);
}
}
private static class PaintingSpawnRunnable implements Runnable {
@Override
public void run() {
@ -58,7 +61,7 @@ public class BukkitPainting extends BukkitEntity {
try {
spawn.spawn();
} catch (Throwable t) {
t.printStackTrace();
log.log(Level.WARNING, "Failed to spawn painting", t);
continue;
}
}
@ -82,6 +85,7 @@ public class BukkitPainting extends BukkitEntity {
* @param weLoc The WorldEdit location
* @return Whether the spawn as successful
*/
@Override
public boolean spawn(Location weLoc) {
synchronized (spawnQueue) {
spawnQueue.add(new QueuedPaintingSpawn(weLoc));
@ -102,4 +106,5 @@ public class BukkitPainting extends BukkitEntity {
}
return false;
}
}

Datei anzeigen

@ -24,7 +24,6 @@ import java.util.List;
import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.regions.selector.Polygonal2DRegionSelector;
import com.sk89q.worldedit.regions.RegionSelector;
import org.bukkit.World;
import com.sk89q.worldedit.BlockVector2D;
import com.sk89q.worldedit.bukkit.BukkitUtil;

Datei anzeigen

@ -52,6 +52,7 @@ public abstract class RegionSelection implements Selection {
this.region = region;
}
@Override
public RegionSelector getRegionSelector() {
return selector;
}
@ -60,48 +61,58 @@ public abstract class RegionSelection implements Selection {
this.selector = selector;
}
@Override
public Location getMinimumPoint() {
return toLocation(world, region.getMinimumPoint());
}
@Override
public Vector getNativeMinimumPoint() {
return region.getMinimumPoint();
}
@Override
public Location getMaximumPoint() {
return toLocation(world, region.getMaximumPoint());
}
@Override
public Vector getNativeMaximumPoint() {
return region.getMaximumPoint();
}
@Override
public World getWorld() {
return world;
}
@Override
public int getArea() {
return region.getArea();
}
@Override
public int getWidth() {
return region.getWidth();
}
@Override
public int getHeight() {
return region.getHeight();
}
@Override
public int getLength() {
return region.getLength();
}
public boolean contains(Location pt) {
if (!pt.getWorld().equals(world)) {
@Override
public boolean contains(Location position) {
if (!position.getWorld().equals(world)) {
return false;
}
return region.contains(toVector(pt));
return region.contains(toVector(position));
}
}

Datei anzeigen

@ -24,7 +24,13 @@ import org.bukkit.World;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.regions.RegionSelector;
import javax.annotation.Nullable;
/**
* An abstraction of WorldEdit regions, which do not use Bukkit objects.
*/
public interface Selection {
/**
* Get the lower point of a region.
*
@ -56,15 +62,16 @@ public interface Selection {
/**
* Get the region selector. This is for internal use.
*
* @return
* @return the region selector
*/
public RegionSelector getRegionSelector();
/**
* Get the world.
*
* @return
* @return the world, which may be null
*/
@Nullable
public World getWorld();
/**
@ -98,8 +105,9 @@ public interface Selection {
/**
* Returns true based on whether the region contains the point,
*
* @param pt
* @return
* @param position a vector
* @return true if it is contained
*/
public boolean contains(Location pt);
public boolean contains(Location position);
}

Datei anzeigen

@ -19,14 +19,12 @@
package com.sk89q.worldedit.forge;
import java.util.Map;
import com.sk89q.worldedit.blocks.BaseItemStack;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import com.sk89q.worldedit.blocks.BaseItemStack;
import cpw.mods.fml.common.FMLCommonHandler;
import java.util.Map;
public final class ForgeUtil {
@ -41,7 +39,7 @@ public final class ForgeUtil {
public static ItemStack toForgeItemStack(BaseItemStack item) {
ItemStack ret = new ItemStack(item.getType(), item.getAmount(), item.getData());
for (Map.Entry<Integer, Integer> entry : item.getEnchantments().entrySet()) {
ret.addEnchantment(net.minecraft.enchantment.Enchantment.enchantmentsList[((Integer)entry.getKey()).intValue()], ((Integer)entry.getValue()).intValue());
ret.addEnchantment(net.minecraft.enchantment.Enchantment.enchantmentsList[((Integer) entry.getKey())], (Integer) entry.getValue());
}
return ret;

Datei anzeigen

@ -33,7 +33,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
/**
* Utility methods for setting tile entities in the world.
*/
class TileEntityUtils {
final class TileEntityUtils {
private TileEntityUtils() {
}
@ -110,7 +110,8 @@ class TileEntityUtils {
* @param clazz the class
* @return a tile entity (may be null if it failed)
*/
static @Nullable TileEntity constructTileEntity(World world, Vector position, Class<? extends TileEntity> clazz) {
@Nullable
static TileEntity constructTileEntity(World world, Vector position, Class<? extends TileEntity> clazz) {
Constructor<? extends TileEntity> baseConstructor;
try {
baseConstructor = clazz.getConstructor(); // creates "blank" TE

Datei anzeigen

@ -33,6 +33,7 @@ import cpw.mods.fml.common.network.Player;
public class WECUIPacketHandler implements IPacketHandler {
public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8");
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) {
if (player instanceof EntityPlayerMP) {
LocalSession session = ForgeWorldEdit.inst.getSession((EntityPlayerMP) player);

Datei anzeigen

@ -25,13 +25,16 @@ import com.sk89q.worldedit.blocks.*;
/**
* @deprecated Block bags are currently not a supported feature of WorldEdit
*/
@SuppressWarnings("deprecation")
@Deprecated
public abstract class BlockBag {
/**
* Stores a block as if it was mined.
*
* @param id
* @throws BlockBagException
* @param id the ID of the block
* @throws BlockBagException thrown on a error
* @deprecated Use {@link BlockBag#storeDroppedBlock(int, int)} instead
*/
@Deprecated
@ -42,9 +45,9 @@ public abstract class BlockBag {
/**
* Stores a block as if it was mined.
*
* @param id
* @param data
* @throws BlockBagException
* @param id the ID of the block
* @param data the data value of the block
* @throws BlockBagException thrown on a error
*/
public void storeDroppedBlock(int id, int data) throws BlockBagException {
BaseItem dropped = BlockType.getBlockBagItem(id, data);
@ -57,7 +60,7 @@ public abstract class BlockBag {
/**
* Sets a block as if it was placed by hand.
*
* @param id
* @param id the ID of the block
* @throws BlockBagException
* @deprecated Use {@link #fetchPlacedBlock(int,int)} instead
*/
@ -69,8 +72,8 @@ public abstract class BlockBag {
/**
* Sets a block as if it was placed by hand.
*
* @param id
* @param data TODO
* @param id the ID of the block
* @param data the data value of the block
* @throws BlockBagException
*/
public void fetchPlacedBlock(int id, int data) throws BlockBagException {
@ -118,7 +121,7 @@ public abstract class BlockBag {
*
* Either this method or fetchItem needs to be overridden
*
* @param id
* @param id the ID of the block
* @throws BlockBagException
*/
public void fetchBlock(int id) throws BlockBagException {
@ -130,7 +133,7 @@ public abstract class BlockBag {
*
* Either this method or fetchBlock needs to be overridden
*
* @param item
* @param item the item
* @throws BlockBagException
*/
public void fetchItem(BaseItem item) throws BlockBagException {
@ -142,7 +145,7 @@ public abstract class BlockBag {
*
* Either this method or storeItem needs to be overridden
*
* @param id
* @param id the ID of the block
* @throws BlockBagException
*/
public void storeBlock(int id) throws BlockBagException {
@ -154,7 +157,7 @@ public abstract class BlockBag {
*
* Either this method or storeBlock needs to be overridden
*
* @param item
* @param item the item
* @throws BlockBagException
*/
public void storeItem(BaseItem item) throws BlockBagException {
@ -164,7 +167,7 @@ public abstract class BlockBag {
/**
* Checks to see if a block exists without removing it.
*
* @param id
* @param id the ID of the block
* @return whether the block exists
*/
public boolean peekBlock(int id) {
@ -185,14 +188,15 @@ public abstract class BlockBag {
/**
* Adds a position to be used a source.
*
* @param pos
* @param position the position of the source
*/
public abstract void addSourcePosition(WorldVector pos);
public abstract void addSourcePosition(WorldVector position);
/**
* Adds a position to be used a source.
*
* @param pos
* @param position the position of the source
*/
public abstract void addSingleSourcePosition(WorldVector pos);
public abstract void addSingleSourcePosition(WorldVector position);
}

Datei anzeigen

@ -25,5 +25,5 @@ package com.sk89q.worldedit.bags;
*/
@Deprecated
public class BlockBagException extends Exception {
private static final long serialVersionUID = 4672190086028430655L;
}

Datei anzeigen

@ -25,5 +25,5 @@ package com.sk89q.worldedit.bags;
*/
@Deprecated
public class OutOfBlocksException extends BlockBagException {
private static final long serialVersionUID = 7495899825677689509L;
}

Datei anzeigen

@ -25,16 +25,13 @@ package com.sk89q.worldedit.bags;
*/
@Deprecated
public class OutOfSpaceException extends BlockBagException {
private static final long serialVersionUID = -2962840237632916821L;
/**
* Stores the block ID.
*/
private int id;
/**
* Construct the object.
* @param id
*
* @param id the type ID
*/
public OutOfSpaceException(int id) {
this.id = id;

Datei anzeigen

@ -25,6 +25,5 @@ package com.sk89q.worldedit.bags;
*/
@Deprecated
public class UnplaceableBlockException extends BlockBagException {
private static final long serialVersionUID = 7227883966999843526L;
}

Datei anzeigen

@ -34,8 +34,6 @@ import java.util.Map;
/**
* Represents a chest block.
*
* @author sk89q
*/
public class ChestBlock extends ContainerBlock {
@ -109,4 +107,5 @@ public class ChestBlock extends ContainerBlock {
throw new RuntimeException(e);
}
}
}

Datei anzeigen

@ -19,11 +19,6 @@
package com.sk89q.worldedit.blocks;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.sk89q.jnbt.ByteTag;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.ListTag;
@ -32,10 +27,13 @@ import com.sk89q.jnbt.ShortTag;
import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.world.DataException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Represents a block that stores items.
*
* @author sk89q
*/
public abstract class ContainerBlock extends BaseBlock implements TileEntityBlock {
@ -54,7 +52,7 @@ public abstract class ContainerBlock extends BaseBlock implements TileEntityBloc
/**
* Get the list of items.
*
* @return
* @return an array of stored items
*/
public BaseItemStack[] getItems() {
return this.items;
@ -63,7 +61,7 @@ public abstract class ContainerBlock extends BaseBlock implements TileEntityBloc
/**
* Set the list of items.
*
* @param items
* @param items an array of stored items
*/
public void setItems(BaseItemStack[] items) {
this.items = items;
@ -79,7 +77,7 @@ public abstract class ContainerBlock extends BaseBlock implements TileEntityBloc
data.put("id", new ShortTag("id", (short) item.getType()));
data.put("Damage", new ShortTag("Damage", item.getData()));
data.put("Count", new ByteTag("Count", (byte) item.getAmount()));
if (item.getEnchantments().size() > 0) {
if (!item.getEnchantments().isEmpty()) {
List<CompoundTag> enchantmentList = new ArrayList<CompoundTag>();
for(Map.Entry<Integer, Integer> entry : item.getEnchantments().entrySet()) {
Map<String, Tag> enchantment = new HashMap<String, Tag>();
@ -139,4 +137,5 @@ public abstract class ContainerBlock extends BaseBlock implements TileEntityBloc
}
return tags;
}
}

Datei anzeigen

@ -33,8 +33,6 @@ import java.util.Map;
/**
* Represents dispensers.
*
* @author sk89q
*/
public class DispenserBlock extends ContainerBlock {
@ -106,4 +104,5 @@ public class DispenserBlock extends ContainerBlock {
throw new RuntimeException(e);
}
}
}

Datei anzeigen

@ -34,8 +34,6 @@ import java.util.Map;
/**
* Represents a furnace block.
*
* @author sk89q
*/
public class FurnaceBlock extends ContainerBlock {
@ -164,4 +162,5 @@ public class FurnaceBlock extends ContainerBlock {
throw new RuntimeException(e);
}
}
}

Datei anzeigen

@ -29,12 +29,12 @@ import static com.google.common.base.Preconditions.checkNotNull;
* A implementation of a lazy block for {@link Extent#getLazyBlock(Vector)}
* that takes the block's ID and metadata, but will defer loading of NBT
* data until time of access.
* </p>
* NBT data is later loaded using a call to {@link Extent#getBlock(Vector)}
* with a stored {@link Extent} and location.
* </p>
* All mutators on this object will throw an
* {@link UnsupportedOperationException}.
*
* <p>NBT data is later loaded using a call to {@link Extent#getBlock(Vector)}
* with a stored {@link Extent} and location.</p>
*
* <p>All mutators on this object will throw an
* {@link UnsupportedOperationException}.</p>
*/
public class LazyBlock extends BaseBlock {

Datei anzeigen

@ -33,8 +33,6 @@ import java.util.Map;
/**
* A mob spawner block.
*
* @author sk89q
*/
public class MobSpawnerBlock extends BaseBlock implements TileEntityBlock {
@ -247,6 +245,6 @@ public class MobSpawnerBlock extends BaseBlock implements TileEntityBlock {
if (spawnDataTag != null) {
this.spawnData = new CompoundTag("SpawnData", spawnDataTag.getValue());
}
}
}

Datei anzeigen

@ -29,8 +29,6 @@ import java.util.Map;
/**
* A note block.
*
* @author sk89q
*/
public class NoteBlock extends BaseBlock implements TileEntityBlock {
@ -120,4 +118,5 @@ public class NoteBlock extends BaseBlock implements TileEntityBlock {
note = ((ByteTag) t).getValue();
}
}
}

Datei anzeigen

@ -28,8 +28,6 @@ import java.util.Map;
/**
* Represents a sign block.
*
* @author sk89q
*/
public class SignBlock extends BaseBlock implements TileEntityBlock {
@ -139,4 +137,5 @@ public class SignBlock extends BaseBlock implements TileEntityBlock {
text[3] = ((StringTag) t).getValue();
}
}
}

Datei anzeigen

@ -64,8 +64,8 @@ public class BlockMask extends AbstractMask {
}
@Override
public boolean matches(EditSession editSession, Vector pos) {
BaseBlock block = editSession.getBlock(pos);
public boolean matches(EditSession editSession, Vector position) {
BaseBlock block = editSession.getBlock(position);
return blocks.contains(block)
|| blocks.contains(new BaseBlock(block.getType(), -1));
}

Datei anzeigen

@ -19,17 +19,18 @@
package com.sk89q.worldedit.masks;
import java.util.Set;
import com.sk89q.worldedit.blocks.BaseBlock;
import java.util.Set;
/**
* A filter that matches blocks based on block types.
*
* @deprecated replaced by {@link #BlockMask}
* @author sk89q
* @deprecated replaced by {@link #BlockMask}
*/
@Deprecated
public class BlockTypeMask extends BlockMask {
public BlockTypeMask() {
super();
}
@ -49,4 +50,5 @@ public class BlockTypeMask extends BlockMask {
public void add(int type) {
add(new BaseBlock(type));
}
}

Datei anzeigen

@ -72,9 +72,9 @@ public class CombinedMask extends AbstractMask {
}
@Override
public boolean matches(EditSession editSession, Vector pos) {
public boolean matches(EditSession editSession, Vector position) {
for (Mask mask : masks) {
if (!mask.matches(editSession, pos)) {
if (!mask.matches(editSession, position)) {
return false;
}
}

Datei anzeigen

@ -40,7 +40,7 @@ public class DynamicRegionMask extends AbstractMask {
}
@Override
public boolean matches(EditSession editSession, Vector pos) {
return region == null || region.contains(pos);
public boolean matches(EditSession editSession, Vector position) {
return region == null || region.contains(position);
}
}

Datei anzeigen

@ -29,7 +29,7 @@ import com.sk89q.worldedit.blocks.BlockID;
@Deprecated
public class ExistingBlockMask extends AbstractMask {
@Override
public boolean matches(EditSession editSession, Vector pos) {
return editSession.getBlockType(pos) != BlockID.AIR;
public boolean matches(EditSession editSession, Vector position) {
return editSession.getBlockType(position) != BlockID.AIR;
}
}

Datei anzeigen

@ -24,6 +24,7 @@ import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.Blocks;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@ -51,15 +52,13 @@ public class FuzzyBlockMask extends AbstractMask {
*/
public FuzzyBlockMask(BaseBlock... block) {
Set<BaseBlock> filter = new HashSet<BaseBlock>();
for (BaseBlock b : block) {
filter.add(b);
}
Collections.addAll(filter, block);
this.filter = filter;
}
@Override
public boolean matches(EditSession editSession, Vector pos) {
BaseBlock compare = new BaseBlock(editSession.getBlockType(pos), editSession.getBlockData(pos));
public boolean matches(EditSession editSession, Vector position) {
BaseBlock compare = new BaseBlock(editSession.getBlockType(position), editSession.getBlockData(position));
return Blocks.containsFuzzy(filter, compare);
}
}

Datei anzeigen

@ -19,36 +19,31 @@
package com.sk89q.worldedit.masks;
import java.util.Set;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.Vector;
import java.util.Set;
/**
* A block type mask that only matches blocks that are not in the list.
*
* @author sk89q
*/
@Deprecated
public class InvertedBlockTypeMask extends BlockTypeMask {
public InvertedBlockTypeMask() {
}
/**
* @param types
*/
public InvertedBlockTypeMask(Set<Integer> types) {
super(types);
}
/**
* @param type
*/
public InvertedBlockTypeMask(int type) {
super(type);
}
@Override
public boolean matches(EditSession editSession, Vector pos) {
return !super.matches(editSession, pos);
public boolean matches(EditSession editSession, Vector position) {
return !super.matches(editSession, position);
}
}

Datei anzeigen

@ -36,13 +36,14 @@ public class InvertedMask extends AbstractMask {
this.mask = mask;
}
@Override
public void prepare(LocalSession session, LocalPlayer player, Vector target) {
mask.prepare(session, player, target);
}
@Override
public boolean matches(EditSession editSession, Vector pos) {
return !mask.matches(editSession, pos);
public boolean matches(EditSession editSession, Vector position) {
return !mask.matches(editSession, position);
}
public Mask getInvertedMask() {

Datei anzeigen

@ -33,8 +33,8 @@ public interface Mask {
/**
* Called one time before each edit session.
*
* @param session
* @param player
* @param session a session
* @param player a player
* @param target target of the brush, null if not a brush mask
*/
void prepare(LocalSession session, LocalPlayer player, Vector target);
@ -45,9 +45,10 @@ public interface Mask {
* as getting a BaseBlock has unneeded overhead in most block querying
* situations (enumerating a chest's contents is a waste, for example).
*
* @param editSession
* @param pos
* @return
* @param editSession an instance
* @param position the position to check
* @return true if it matches
*/
boolean matches(EditSession editSession, Vector pos);
boolean matches(EditSession editSession, Vector position);
}

Datei anzeigen

@ -35,7 +35,7 @@ public class RandomMask extends AbstractMask {
}
@Override
public boolean matches(EditSession editSession, Vector pos) {
public boolean matches(EditSession editSession, Vector position) {
return Math.random() < ratio;
}
}

Datei anzeigen

@ -35,7 +35,7 @@ public class RegionMask extends AbstractMask {
}
@Override
public boolean matches(EditSession editSession, Vector pos) {
return region.contains(pos);
public boolean matches(EditSession editSession, Vector position) {
return region.contains(position);
}
}

Datei anzeigen

@ -29,7 +29,7 @@ import com.sk89q.worldedit.blocks.BlockType;
@Deprecated
public class SolidBlockMask extends AbstractMask {
@Override
public boolean matches(EditSession editSession, Vector pos) {
return !BlockType.canPassThrough(editSession.getBlockType(pos), editSession.getBlockData(pos));
public boolean matches(EditSession editSession, Vector position) {
return !BlockType.canPassThrough(editSession.getBlockType(position), editSession.getBlockData(position));
}
}

Datei anzeigen

@ -70,7 +70,7 @@ public class UnderOverlayMask extends AbstractMask {
}
@Override
public boolean matches(EditSession editSession, Vector pos) {
return !mask.matches(editSession, pos) && mask.matches(editSession, pos.add(0, yMod, 0));
public boolean matches(EditSession editSession, Vector position) {
return !mask.matches(editSession, position) && mask.matches(editSession, position.add(0, yMod, 0));
}
}

Datei anzeigen

@ -26,20 +26,15 @@ import com.sk89q.worldedit.blocks.BaseBlock;
*/
@Deprecated
public class BlockChance {
/**
* Block.
*/
private BaseBlock block;
/**
* Chance. Can be any positive value.
*/
private double chance;
/**
* Construct the object.
*
* @param block
* @param chance
* @param block the block
* @param chance the probability of the block
*/
public BlockChance(BaseBlock block, double chance) {
this.block = block;
@ -59,4 +54,5 @@ public class BlockChance {
public double getChance() {
return chance;
}
}

Datei anzeigen

@ -24,47 +24,28 @@ import com.sk89q.worldedit.blocks.BaseBlock;
/**
* Pattern that repeats the clipboard.
*
* @author sk89q
*/
public class ClipboardPattern implements Pattern {
/**
* Clipboard.
*/
private CuboidClipboard clipboard;
/**
* Size of the clipboard.
*/
private Vector size;
/**
* Construct the object.
*
* @param clipboard
* @param clipboard the clipboard
*/
public ClipboardPattern(CuboidClipboard clipboard) {
this.clipboard = clipboard;
this.size = clipboard.getSize();
}
/**
* Get next block.
*
* @param pos
* @return
*/
public BaseBlock next(Vector pos) {
return next(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
@Override
public BaseBlock next(Vector position) {
return next(position.getBlockX(), position.getBlockY(), position.getBlockZ());
}
/**
* Get next block.
*
* @param x
* @param y
* @param z
* @return
*/
@Override
public BaseBlock next(int x, int y, int z) {
int xp = Math.abs(x) % size.getBlockX();
int yp = Math.abs(y) % size.getBlockY();
@ -72,4 +53,5 @@ public class ClipboardPattern implements Pattern {
return clipboard.getPoint(new Vector(xp, yp, zp));
}
}

Datei anzeigen

@ -27,21 +27,25 @@ import com.sk89q.worldedit.blocks.BaseBlock;
*/
@Deprecated
public interface Pattern {
/**
* Get a block for a position. This return value of this method does
* not have to be consistent for the same position.
*
* @param pos
* @return
*/
public BaseBlock next(Vector pos);
/**
* Get a block for a position. This return value of this method does
* not have to be consistent for the same position.
*
* @param pos
* @return
* @param position the position where a block is needed
* @return a block
*/
public BaseBlock next(Vector position);
/**
* Get a block for a position. This return value of this method does
* not have to be consistent for the same position.
*
* @param x the X coordinate
* @param y the Y coordinate
* @param z the Z coordinate
* @return a block
*/
public BaseBlock next(int x, int y, int z);
}

Datei anzeigen

@ -32,19 +32,14 @@ import java.util.Random;
*/
@Deprecated
public class RandomFillPattern implements Pattern {
/**
* Random number generator.
*/
private static final Random random = new Random();
/**
* Blocks and their proportions.
*/
private List<BlockChance> blocks;
/**
* Construct the object.
*
* @param blocks
* @param blocks a list of blocks
*/
public RandomFillPattern(List<BlockChance> blocks) {
double max = 0;
@ -66,13 +61,8 @@ public class RandomFillPattern implements Pattern {
this.blocks = finalBlocks;
}
/**
* Get next block.
*
* @param pos
* @return
*/
public BaseBlock next(Vector pos) {
@Override
public BaseBlock next(Vector position) {
double r = random.nextDouble();
for (BlockChance block : blocks) {
@ -84,7 +74,9 @@ public class RandomFillPattern implements Pattern {
throw new RuntimeException("ProportionalFillPattern");
}
@Override
public BaseBlock next(int x, int y, int z) {
return next(null);
}
}

Datei anzeigen

@ -28,40 +28,35 @@ import com.sk89q.worldedit.function.pattern.BlockPattern;
*/
@Deprecated
public class SingleBlockPattern implements Pattern {
/**
* Block type.
*/
private BaseBlock block;
/**
* Construct the object.
*
* @param block
* @param block the block
*/
public SingleBlockPattern(BaseBlock block) {
this.block = block;
}
/**
* Get next block.
*
* @param pos
* @return
*/
public BaseBlock next(Vector pos) {
return block;
}
public BaseBlock next(int x, int y, int z) {
return block;
}
/**
* Get the block.
*
* @return
* @return the block
*/
public BaseBlock getBlock() {
return block;
}
@Override
public BaseBlock next(Vector position) {
return block;
}
@Override
public BaseBlock next(int x, int y, int z) {
return block;
}
}

Datei anzeigen

@ -20,10 +20,7 @@
package com.sk89q.jnbt;
/**
* The <code>TAG_End</code> tag.
*
* @author Graham Edgecombe
*
* The {@code TAG_End} tag.
*/
public final class EndTag extends Tag {

Datei anzeigen

@ -71,7 +71,7 @@ public final class IntArrayTag extends Tag {
if (name != null && !name.equals("")) {
append = "(\"" + this.getName() + "\")";
}
return "TAG_Int_Array" + append + ": " + hex.toString();
return "TAG_Int_Array" + append + ": " + hex;
}
}

Datei anzeigen

@ -437,12 +437,9 @@ public final class ListTag extends Tag {
append = "(\"" + this.getName() + "\")";
}
StringBuilder bldr = new StringBuilder();
bldr.append("TAG_List" + append + ": " + value.size()
+ " entries of type " + NBTUtils.getTypeName(type)
+ "\r\n{\r\n");
bldr.append("TAG_List").append(append).append(": ").append(value.size()).append(" entries of type ").append(NBTUtils.getTypeName(type)).append("\r\n{\r\n");
for (Tag t : value) {
bldr.append(" " + t.toString().replaceAll("\r\n", "\r\n ")
+ "\r\n");
bldr.append(" ").append(t.toString().replaceAll("\r\n", "\r\n ")).append("\r\n");
}
bldr.append("}");
return bldr.toString();

Datei anzeigen

@ -23,9 +23,6 @@ import java.nio.charset.Charset;
/**
* A class which holds constant values.
*
* @author Graham Edgecombe
*
*/
public final class NBTConstants {

Datei anzeigen

@ -29,20 +29,13 @@ import java.util.List;
import java.util.Map;
/**
* <p>
* This class reads <strong>NBT</strong>, or <strong>Named Binary Tag</strong>
* streams, and produces an object graph of subclasses of the <code>Tag</code>
* streams, and produces an object graph of subclasses of the {@code Tag}
* object.
* </p>
*
* <p>
* The NBT format was created by Markus Persson, and the specification may be
* <p>The NBT format was created by Markus Persson, and the specification may be
* found at <a href="http://www.minecraft.net/docs/NBT.txt">
* http://www.minecraft.net/docs/NBT.txt</a>.
* </p>
*
* @author Graham Edgecombe
*
* http://www.minecraft.net/docs/NBT.txt</a>.</p>
*/
public final class NBTInputStream implements Closeable {

Datei anzeigen

@ -26,19 +26,12 @@ import java.io.OutputStream;
import java.util.List;
/**
* <p>
* This class writes <strong>NBT</strong>, or <strong>Named Binary Tag</strong>
* <code>Tag</code> objects to an underlying <code>OutputStream</code>.
* </p>
* {@code Tag} objects to an underlying {@code OutputStream}.
*
* <p>
* The NBT format was created by Markus Persson, and the specification may be
* <p>The NBT format was created by Markus Persson, and the specification may be
* found at <a href="http://www.minecraft.net/docs/NBT.txt">
* http://www.minecraft.net/docs/NBT.txt</a>.
* </p>
*
* @author Graham Edgecombe
*
* http://www.minecraft.net/docs/NBT.txt</a>.</p>
*/
public final class NBTOutputStream implements Closeable {
@ -48,7 +41,7 @@ public final class NBTOutputStream implements Closeable {
private final DataOutputStream os;
/**
* Creates a new <code>NBTOutputStream</code>, which will write data to the
* Creates a new {@code NBTOutputStream}, which will write data to the
* specified underlying output stream.
*
* @param os
@ -137,7 +130,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
* Writes a <code>TAG_Byte</code> tag.
* Writes a {@code TAG_Byte} tag.
*
* @param tag
* The tag.
@ -149,7 +142,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
* Writes a <code>TAG_Byte_Array</code> tag.
* Writes a {@code TAG_Byte_Array} tag.
*
* @param tag
* The tag.
@ -163,7 +156,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
* Writes a <code>TAG_Compound</code> tag.
* Writes a {@code TAG_Compound} tag.
*
* @param tag
* The tag.
@ -178,7 +171,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
* Writes a <code>TAG_List</code> tag.
* Writes a {@code TAG_List} tag.
*
* @param tag
* The tag.
@ -192,13 +185,13 @@ public final class NBTOutputStream implements Closeable {
os.writeByte(NBTUtils.getTypeCode(clazz));
os.writeInt(size);
for (int i = 0; i < size; ++i) {
writeTagPayload(tags.get(i));
for (Tag tag1 : tags) {
writeTagPayload(tag1);
}
}
/**
* Writes a <code>TAG_String</code> tag.
* Writes a {@code TAG_String} tag.
*
* @param tag
* The tag.
@ -212,7 +205,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
* Writes a <code>TAG_Double</code> tag.
* Writes a {@code TAG_Double} tag.
*
* @param tag
* The tag.
@ -224,7 +217,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
* Writes a <code>TAG_Float</code> tag.
* Writes a {@code TAG_Float} tag.
*
* @param tag
* The tag.
@ -236,7 +229,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
* Writes a <code>TAG_Long</code> tag.
* Writes a {@code TAG_Long} tag.
*
* @param tag
* The tag.
@ -248,7 +241,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
* Writes a <code>TAG_Int</code> tag.
* Writes a {@code TAG_Int} tag.
*
* @param tag
* The tag.
@ -260,7 +253,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
* Writes a <code>TAG_Short</code> tag.
* Writes a {@code TAG_Short} tag.
*
* @param tag
* The tag.
@ -272,12 +265,9 @@ public final class NBTOutputStream implements Closeable {
}
/**
* Writes a <code>TAG_Empty</code> tag.
* Writes a {@code TAG_Empty} tag.
*
* @param tag
* The tag.
* @throws IOException
* if an I/O error occurs.
* @param tag the tag
*/
private void writeEndTagPayload(EndTag tag) {
/* empty */
@ -286,11 +276,12 @@ public final class NBTOutputStream implements Closeable {
private void writeIntArrayTagPayload(IntArrayTag tag) throws IOException {
int[] data = tag.getValue();
os.writeInt(data.length);
for (int i = 0; i < data.length; i++) {
os.writeInt(data[i]);
for (int aData : data) {
os.writeInt(aData);
}
}
@Override
public void close() throws IOException {
os.close();
}

Datei anzeigen

@ -20,8 +20,6 @@
package com.sk89q.jnbt;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.storage.InvalidFormatException;
import java.util.Map;
@ -171,14 +169,13 @@ public final class NBTUtils {
/**
* Get child tag of a NBT structure.
*
* @param items
* @param key
* @param expected
* @param items the map to read from
* @param key the key to look for
* @param expected the expected NBT class type
* @return child tag
* @throws InvalidFormatException
*/
public static <T extends Tag> T getChildTag(Map<String,Tag> items, String key,
Class<T> expected) throws InvalidFormatException {
public static <T extends Tag> T getChildTag(Map<String, Tag> items, String key, Class<T> expected) throws InvalidFormatException {
if (!items.containsKey(key)) {
throw new InvalidFormatException("Missing a \"" + key + "\" tag");
}

Datei anzeigen

@ -26,11 +26,10 @@ import java.lang.annotation.RetentionPolicy;
* This annotation indicates a command. Methods should be marked with this
* annotation to tell {@link CommandsManager} that the method is a command.
* Note that the method name can actually be anything.
*
* @author sk89q
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface Command {
/**
* A list of aliases for the command. The first alias is the most
* important -- it is the main name of the command. (The method name
@ -42,7 +41,7 @@ public @interface Command {
/**
* Usage instruction. Example text for usage could be
* <code>[-h harps] [name] [message]</code>.
* {@code [-h harps] [name] [message]}.
*
* @return Usage instructions for a command
*/
@ -85,9 +84,10 @@ public @interface Command {
String help() default "";
/**
* Get whether any flag can be used.
*
*
* @return Whether any flag can be provided to the command, even if it is not in {@link #flags()}
* @return true if so
*/
boolean anyFlags() default false;
}

Datei anzeigen

@ -26,16 +26,15 @@ import java.lang.annotation.RetentionPolicy;
* Any command with this annotation will run the raw command as shown in the
* thing, as long as it is registered in the current {@link CommandsManager}.
* Mostly to move commands around without breaking things.
*
* @author zml2008
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface CommandAlias {
/**
* Get the raw {@link CommandsManager}-formatted command arg array to run
*
* @return Raw {@link CommandsManager}-formatted command arg array to run
* @return the command
*/
String[] value();
}

Datei anzeigen

@ -94,7 +94,7 @@ public class CommandContext {
isHanging = false;
String arg = args[i];
if (arg.length() == 0) {
if (arg.isEmpty()) {
isHanging = true;
continue;
}
@ -127,7 +127,7 @@ public class CommandContext {
}
// In case there is an empty quoted string
if (arg.length() == 0) {
if (arg.isEmpty()) {
continue;
}
// else raise exception about hanging quotes?

Datei anzeigen

@ -27,8 +27,7 @@ import java.util.ListIterator;
import static com.google.common.base.Preconditions.checkNotNull;
public class CommandException extends Exception {
private static final long serialVersionUID = 870638193072101739L;
private List<String> commandStack = new ArrayList<String>();
public CommandException() {

Datei anzeigen

@ -24,14 +24,14 @@ import java.lang.annotation.RetentionPolicy;
/**
* Indicates a list of permissions that should be checked.
*
* @author sk89q
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface CommandPermissions {
/**
* A list of permissions. Only one permission has to be met
* for the command to be permitted.
*/
String[] value();
}

Datei anzeigen

@ -21,9 +21,7 @@ package com.sk89q.minecraft.util.commands;
/**
* Thrown when not enough permissions are satisfied.
*
* @author sk89q
*/
public class CommandPermissionsException extends CommandException {
private static final long serialVersionUID = -602374621030168291L;
}

Datei anzeigen

@ -20,7 +20,6 @@
package com.sk89q.minecraft.util.commands;
public class CommandUsageException extends CommandException {
private static final long serialVersionUID = -6761418114414516542L;
protected String usage;

Datei anzeigen

@ -19,6 +19,8 @@
package com.sk89q.minecraft.util.commands;
import com.sk89q.util.StringUtil;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
@ -31,16 +33,14 @@ import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.sk89q.util.StringUtil;
/**
* <p>Manager for handling commands. This allows you to easily process commands,
* including nested commands, by correctly annotating methods of a class.</p>
* Manager for handling commands. This allows you to easily process commands,
* including nested commands, by correctly annotating methods of a class.
*
* <p>To use this, it is merely a matter of registering classes containing
* the commands (as methods with the proper annotations) with the
* manager. When you want to process a command, use one of the
* <code>execute</code> methods. If something is wrong, such as incorrect
* {@code execute} methods. If something is wrong, such as incorrect
* usage, insufficient permissions, or a missing command altogether, an
* exception will be raised for upstream handling.</p>
*
@ -57,13 +57,11 @@ import com.sk89q.util.StringUtil;
* allows for fast command handling. Method invocation still has to be done
* with reflection, but this is quite fast in that of itself.</p>
*
* @author sk89q
* @param <T> command sender class
*/
@SuppressWarnings("ProtectedField")
public abstract class CommandsManager<T> {
/**
* Logger for general errors.
*/
protected static final Logger logger =
Logger.getLogger(CommandsManager.class.getCanonicalName());
@ -105,7 +103,7 @@ public abstract class CommandsManager<T> {
* instances will be created of the command classes and methods will
* not be called statically.
*
* @param cls
* @param cls the class to register
*/
public void register(Class<?> cls) {
registerMethods(cls, null);
@ -119,7 +117,7 @@ public abstract class CommandsManager<T> {
* not be called statically. A List of {@link Command} annotations from
* registered commands is returned.
*
* @param cls
* @param cls the class to register
* @return A List of {@link Command} annotations from registered commands,
* for use in eg. a dynamic command registration system.
*/
@ -131,8 +129,8 @@ public abstract class CommandsManager<T> {
* Register the methods of a class. This will automatically construct
* instances as necessary.
*
* @param cls
* @param parent
* @param cls the class to register
* @param parent the parent method
* @return Commands Registered
*/
public List<Command> registerMethods(Class<?> cls, Method parent) {
@ -156,10 +154,10 @@ public abstract class CommandsManager<T> {
/**
* Register the methods of a class.
*
* @param cls
* @param parent
* @param obj
* @return
* @param cls the class to register
* @param parent the parent method
* @param obj the object whose methods will become commands if they are annotated
* @return a list of commands
*/
private List<Command> registerMethods(Class<?> cls, Method parent, Object obj) {
Map<String, Method> map;
@ -205,14 +203,14 @@ public abstract class CommandsManager<T> {
final String desc = cmd.desc();
final String usage = cmd.usage();
if (usage.length() == 0) {
if (usage.isEmpty()) {
descs.put(commandName, desc);
} else {
descs.put(commandName, usage + " - " + desc);
}
String help = cmd.help();
if (help.length() == 0) {
if (help.isEmpty()) {
help = desc;
}
@ -255,8 +253,8 @@ public abstract class CommandsManager<T> {
* Checks to see whether there is a command named such at the root level.
* This will check aliases as well.
*
* @param command
* @return
* @param command the command
* @return true if the command exists
*/
public boolean hasCommand(String command) {
return commands.get(null).containsKey(command.toLowerCase());
@ -265,12 +263,17 @@ public abstract class CommandsManager<T> {
/**
* Get a list of command descriptions. This is only for root commands.
*
* @return
* @return a map of commands
*/
public Map<String, String> getCommands() {
return descs;
}
/**
* Get the mapping of methods under a parent command.
*
* @return the mapping
*/
public Map<Method, Map<String, Method>> getMethods() {
return commands;
}
@ -278,7 +281,7 @@ public abstract class CommandsManager<T> {
/**
* Get a map from command name to help message. This is only for root commands.
*
* @return
* @return a map of help messages for each command
*/
public Map<String, String> getHelpMessages() {
return helpMessages;
@ -287,10 +290,10 @@ public abstract class CommandsManager<T> {
/**
* Get the usage string for a command.
*
* @param args
* @param level
* @param cmd
* @return
* @param args the arguments
* @param level the depth of the command
* @param cmd the command annotation
* @return the usage string
*/
protected String getUsage(String[] args, int level, Command cmd) {
final StringBuilder command = new StringBuilder();
@ -304,7 +307,7 @@ public abstract class CommandsManager<T> {
command.append(getArguments(cmd));
final String help = cmd.help();
if (help.length() > 0) {
if (!help.isEmpty()) {
command.append("\n\n");
command.append(help);
}
@ -316,9 +319,9 @@ public abstract class CommandsManager<T> {
final String flags = cmd.flags();
final StringBuilder command2 = new StringBuilder();
if (flags.length() > 0) {
if (!flags.isEmpty()) {
String flagString = flags.replaceAll(".:", "");
if (flagString.length() > 0) {
if (!flagString.isEmpty()) {
command2.append("[-");
for (int i = 0; i < flagString.length(); ++i) {
command2.append(flagString.charAt(i));
@ -335,22 +338,20 @@ public abstract class CommandsManager<T> {
/**
* Get the usage string for a nested command.
*
* @param args
* @param level
* @param method
* @param player
* @return
* @throws CommandException
* @param args the arguments
* @param level the depth of the command
* @param method the parent method
* @param player the player
* @return the usage string
* @throws CommandException on some error
*/
protected String getNestedUsage(String[] args, int level,
Method method, T player) throws CommandException {
protected String getNestedUsage(String[] args, int level, Method method, T player) throws CommandException {
StringBuilder command = new StringBuilder();
command.append("/");
for (int i = 0; i <= level; ++i) {
command.append(args[i] + " ");
command.append(args[i]).append(" ");
}
Map<String, Method> map = commands.get(method);
@ -371,7 +372,7 @@ public abstract class CommandsManager<T> {
}
}
if (allowedCommands.size() > 0) {
if (!allowedCommands.isEmpty()) {
command.append(StringUtil.joinString(allowedCommands, "|", 0));
} else {
if (!found) {
@ -412,14 +413,12 @@ public abstract class CommandsManager<T> {
/**
* Attempt to execute a command.
*
* @param args
* @param player
* @param methodArgs
* @throws CommandException
* @param args the arguments
* @param player the player
* @param methodArgs the arguments for the method
* @throws CommandException thrown on command error
*/
public void execute(String[] args, T player,
Object... methodArgs) throws CommandException {
public void execute(String[] args, T player, Object... methodArgs) throws CommandException {
Object[] newMethodArgs = new Object[methodArgs.length + 1];
System.arraycopy(methodArgs, 0, newMethodArgs, 1, methodArgs.length);
executeMethod(null, args, player, newMethodArgs, 0);
@ -428,16 +427,14 @@ public abstract class CommandsManager<T> {
/**
* Attempt to execute a command.
*
* @param parent
* @param args
* @param player
* @param methodArgs
* @param level
* @throws CommandException
* @param parent the parent method
* @param args an array of arguments
* @param player the player
* @param methodArgs the array of method arguments
* @param level the depth of the command
* @throws CommandException thrown on a command error
*/
public void executeMethod(Method parent, String[] args,
T player, Object[] methodArgs, int level) throws CommandException {
public void executeMethod(Method parent, String[] args, T player, Object[] methodArgs, int level) throws CommandException {
String cmdName = args[level];
Map<String, Method> map = commands.get(parent);
@ -527,8 +524,7 @@ public abstract class CommandsManager<T> {
}
}
public void invokeMethod(Method parent, String[] args, T player, Method method,
Object instance, Object[] methodArgs, int level) throws CommandException {
public void invokeMethod(Method parent, String[] args, T player, Method method, Object instance, Object[] methodArgs, int level) throws CommandException {
try {
method.invoke(instance, methodArgs);
} catch (IllegalArgumentException e) {
@ -547,9 +543,9 @@ public abstract class CommandsManager<T> {
/**
* Returns whether a player has access to a command.
*
* @param method
* @param player
* @return
* @param method the method
* @param player the player
* @return true if permission is granted
*/
protected boolean hasPermission(Method method, T player) {
CommandPermissions perms = method.getAnnotation(CommandPermissions.class);
@ -569,11 +565,11 @@ public abstract class CommandsManager<T> {
/**
* Returns whether a player permission..
*
* @param player
* @param perm
* @return
* @param player the player
* @param permission the permission
* @return true if permission is granted
*/
public abstract boolean hasPermission(T player, String perm);
public abstract boolean hasPermission(T player, String permission);
/**
* Get the injector used to create new instances. This can be

Datei anzeigen

@ -24,9 +24,8 @@ import java.lang.annotation.RetentionPolicy;
/**
* This annotation indicates that a command can be used from the console.
*
* @author sk89q
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface Console {
}

Datei anzeigen

@ -27,11 +27,10 @@ import java.lang.annotation.RetentionPolicy;
/**
* Indicates how the affected blocks should be hinted at in the log.
*
* @author sk89q
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface Logging {
public enum LogMode {
/**
* Player position
@ -63,4 +62,5 @@ public @interface Logging {
* Log mode. Can be either POSITION, REGION, ORIENTATION_REGION, PLACEMENT or ALL.
*/
LogMode value();
}

Datei anzeigen

@ -20,7 +20,6 @@
package com.sk89q.minecraft.util.commands;
public class MissingNestedCommandException extends CommandUsageException {
private static final long serialVersionUID = -4382896182979285355L;
public MissingNestedCommandException(String message, String usage) {
super(message, usage);

Datei anzeigen

@ -29,11 +29,10 @@ import java.lang.annotation.RetentionPolicy;
* will never called. Additionally, not all fields of {@link Command} apply
* when it is used in conjunction with this annotation, although both
* are still required.
*
* @author sk89q
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface NestedCommand {
/**
* A list of classes with the child commands.
*/
@ -43,4 +42,5 @@ public @interface NestedCommand {
* If set to true it will execute the body of the tagged method.
*/
boolean executeBody() default false;
}

Datei anzeigen

@ -21,10 +21,12 @@ package com.sk89q.minecraft.util.commands;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.logging.Level;
import java.util.logging.Logger;
public class SimpleInjector implements Injector {
private static final Logger logger = Logger.getLogger(SimpleInjector.class.getCanonicalName());
private static final Logger log = Logger.getLogger(SimpleInjector.class.getCanonicalName());
private Object[] args;
private Class<?>[] argClasses;
@ -36,26 +38,23 @@ public class SimpleInjector implements Injector {
}
}
@Override
public Object getInstance(Class<?> clazz) {
try {
Constructor<?> ctr = clazz.getConstructor(argClasses);
ctr.setAccessible(true);
return ctr.newInstance(args);
} catch (NoSuchMethodException e) {
logger.severe("Error initializing commands class " + clazz + ": ");
e.printStackTrace();
log.log(Level.SEVERE, "Error initializing commands class " + clazz, e);
return null;
} catch (InvocationTargetException e) {
logger.severe("Error initializing commands class " + clazz + ": ");
e.printStackTrace();
log.log(Level.SEVERE, "Error initializing commands class " + clazz, e);
return null;
} catch (InstantiationException e) {
logger.severe("Error initializing commands class " + clazz + ": ");
e.printStackTrace();
log.log(Level.SEVERE, "Error initializing commands class " + clazz, e);
return null;
} catch (IllegalAccessException e) {
logger.severe("Error initializing commands class " + clazz + ": ");
e.printStackTrace();
log.log(Level.SEVERE, "Error initializing commands class " + clazz, e);
return null;
}
}

Datei anzeigen

@ -20,6 +20,5 @@
package com.sk89q.minecraft.util.commands;
public class UnhandledCommandException extends CommandException {
private static final long serialVersionUID = 3370887306593968091L;
}

Datei anzeigen

@ -20,9 +20,9 @@
package com.sk89q.minecraft.util.commands;
public class WrappedCommandException extends CommandException {
private static final long serialVersionUID = -4075721444847778918L;
public WrappedCommandException(Throwable t) {
super(t);
}
}

Datei anzeigen

@ -21,9 +21,6 @@ package com.sk89q.util;
import java.lang.reflect.Field;
/**
* @author zml2008
*/
public final class ReflectionUtil {
private ReflectionUtil() {
@ -37,8 +34,8 @@ public final class ReflectionUtil {
Field field = checkClass.getDeclaredField(name);
field.setAccessible(true);
return (T) field.get(from);
} catch (NoSuchFieldException e) {
} catch (IllegalAccessException e) {
} catch (NoSuchFieldException ignored) {
} catch (IllegalAccessException ignored) {
}
} while (checkClass.getSuperclass() != Object.class && ((checkClass = checkClass.getSuperclass()) != null));
return null;

Datei anzeigen

@ -24,8 +24,6 @@ import java.util.Map;
/**
* String utilities.
*
* @author sk89q
*/
public final class StringUtil {
@ -35,9 +33,9 @@ public final class StringUtil {
/**
* Trim a string if it is longer than a certain length.
*
* @param str
* @param len
* @return
* @param str the stirng
* @param len the length to trim to
* @return a new string
*/
public static String trimLength(String str, int len) {
if (str.length() > len) {
@ -50,13 +48,12 @@ public final class StringUtil {
/**
* Join an array of strings into a string.
*
* @param str
* @param delimiter
* @param initialIndex
* @return
* @param str the string array
* @param delimiter the delimiter
* @param initialIndex the initial index to start form
* @return a new string
*/
public static String joinString(String[] str, String delimiter,
int initialIndex) {
public static String joinString(String[] str, String delimiter, int initialIndex) {
if (str.length == 0) {
return "";
}
@ -70,11 +67,11 @@ public final class StringUtil {
/**
* Join an array of strings into a string.
*
* @param str
* @param delimiter
* @param initialIndex
* @param quote
* @return
* @param str the string array
* @param delimiter the delimiter
* @param initialIndex the initial index to start form
* @param quote the character to put around each entry
* @return a new string
*/
public static String joinQuotedString(String[] str, String delimiter,
int initialIndex, String quote) {
@ -94,9 +91,9 @@ public final class StringUtil {
/**
* Join an array of strings into a string.
*
* @param str
* @param delimiter
* @return
* @param str the string array
* @param delimiter the delimiter
* @return a new string
*/
public static String joinString(String[] str, String delimiter) {
return joinString(str, delimiter, 0);
@ -105,19 +102,18 @@ public final class StringUtil {
/**
* Join an array of strings into a string.
*
* @param str
* @param delimiter
* @param initialIndex
* @return
* @param str an array of objects
* @param delimiter the delimiter
* @param initialIndex the initial index to start form
* @return a new string
*/
public static String joinString(Object[] str, String delimiter,
int initialIndex) {
public static String joinString(Object[] str, String delimiter, int initialIndex) {
if (str.length == 0) {
return "";
}
StringBuilder buffer = new StringBuilder(str[initialIndex].toString());
for (int i = initialIndex + 1; i < str.length; ++i) {
buffer.append(delimiter).append(str[i].toString());
buffer.append(delimiter).append(str[i]);
}
return buffer.toString();
}
@ -125,13 +121,12 @@ public final class StringUtil {
/**
* Join an array of strings into a string.
*
* @param str
* @param delimiter
* @param initialIndex
* @return
* @param str a list of integers
* @param delimiter the delimiter
* @param initialIndex the initial index to start form
* @return a new string
*/
public static String joinString(int[] str, String delimiter,
int initialIndex) {
public static String joinString(int[] str, String delimiter, int initialIndex) {
if (str.length == 0) {
return "";
}
@ -144,15 +139,14 @@ public final class StringUtil {
/**
* Join an list of strings into a string.
*
* @param str
* @param delimiter
* @param initialIndex
* @return
*
* @param str a list of strings
* @param delimiter the delimiter
* @param initialIndex the initial index to start form
* @return a new string
*/
public static String joinString(Collection<?> str, String delimiter,
int initialIndex) {
if (str.size() == 0) {
public static String joinString(Collection<?> str, String delimiter,int initialIndex) {
if (str.isEmpty()) {
return "";
}
StringBuilder buffer = new StringBuilder();
@ -163,7 +157,7 @@ public final class StringUtil {
buffer.append(delimiter);
}
buffer.append(o.toString());
buffer.append(o);
}
++i;
}
@ -202,7 +196,7 @@ public final class StringUtil {
* @param s the first String, must not be null
* @param t the second String, must not be null
* @return result distance
* @throws IllegalArgumentException if either String input <code>null</code>
* @throws IllegalArgumentException if either String input {@code null}
*/
public static int getLevenshteinDistance(String s, String t) {
if (s == null || t == null) {
@ -238,9 +232,9 @@ public final class StringUtil {
return n;
}
int p[] = new int[n + 1]; // 'previous' cost array, horizontally
int d[] = new int[n + 1]; // cost array, horizontally
int _d[]; // placeholder to assist in swapping p and d
int[] p = new int[n + 1]; // 'previous' cost array, horizontally
int[] d = new int[n + 1]; // cost array, horizontally
int[] _d; // placeholder to assist in swapping p and d
// indexes into strings s and t
int i; // iterates through s

Datei anzeigen

@ -23,6 +23,7 @@ import com.sk89q.worldedit.BlockVector2D;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.Vector2D;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@ -30,10 +31,9 @@ import java.util.Map;
/**
* Represents a configuration node.
*
* @author sk89q
*/
public class YAMLNode {
protected Map<String, Object> root;
private boolean writeDefaults;
@ -106,8 +106,8 @@ public class YAMLNode {
* Prepare a value for serialization, in case it's not a native type
* (and we don't want to serialize objects as YAML objects).
*
* @param value
* @return
* @param value the value to serialize
* @return the new object
*/
private Object prepareSerialization(Object value) {
if (value instanceof Vector) {
@ -126,8 +126,8 @@ public class YAMLNode {
* Set the property at a location. This will override existing
* configuration data to have it conform to key/value mappings.
*
* @param path
* @param value
* @param path the path
* @param value the new value
*/
@SuppressWarnings("unchecked")
public void setProperty(String path, Object value) {
@ -163,10 +163,10 @@ public class YAMLNode {
/**
* Adds a new node to the given path. The returned object is a reference
* to the new node. This method will replace an existing node at
* the same path. See <code>setProperty</code>.
* the same path. See {@code setProperty}.
*
* @param path
* @return
* @param path the path
* @return a node for the path
*/
public YAMLNode addNode(String path) {
Map<String, Object> map = new LinkedHashMap<String, Object>();
@ -557,9 +557,7 @@ public class YAMLNode {
* @param def default value or null for an empty list as default
* @return list of integers
*/
public List<Vector> getVectorList(
String path, List<Vector> def) {
public List<Vector> getVectorList(String path, List<Vector> def) {
List<YAMLNode> raw = getNodeList(path, null);
List<Vector> list = new ArrayList<Vector>();
@ -589,8 +587,7 @@ public class YAMLNode {
* @param def default value or null for an empty list as default
* @return list of integers
*/
public List<Vector2D> getVector2dList(
String path, List<Vector2D> def) {
public List<Vector2D> getVector2dList(String path, List<Vector2D> def) {
List<YAMLNode> raw = getNodeList(path, null);
List<Vector2D> list = new ArrayList<Vector2D>();
@ -620,8 +617,7 @@ public class YAMLNode {
* @param def default value or null for an empty list as default
* @return list of integers
*/
public List<BlockVector2D> getBlockVector2dList(
String path, List<BlockVector2D> def) {
public List<BlockVector2D> getBlockVector2dList(String path, List<BlockVector2D> def) {
List<YAMLNode> raw = getNodeList(path, null);
List<BlockVector2D> list = new ArrayList<BlockVector2D>();
@ -674,9 +670,10 @@ public class YAMLNode {
* path does not lead to a node, null will be returned. A node has
* key/value mappings.
*
* @param path
* @param path the path
* @return node or null
*/
@Nullable
@SuppressWarnings("unchecked")
public YAMLNode getNode(String path) {
Object raw = getProperty(path);
@ -719,9 +716,10 @@ public class YAMLNode {
/**
* Casts a value to an integer. May return null.
*
* @param o
* @return
* @param o the object
* @return an integer or null
*/
@Nullable
private static Integer castInt(Object o) {
if (o == null) {
return null;
@ -734,10 +732,11 @@ public class YAMLNode {
/**
* Casts a value to a double. May return null.
*
* @param o
* @return
*
* @param o the object
* @return a double or null
*/
@Nullable
private static Double castDouble(Object o) {
if (o == null) {
return null;
@ -750,10 +749,11 @@ public class YAMLNode {
/**
* Casts a value to a boolean. May return null.
*
* @param o
* @return
*
* @param o the object
* @return a boolean or null
*/
@Nullable
private static Boolean castBoolean(Object o) {
if (o == null) {
return null;
@ -768,7 +768,7 @@ public class YAMLNode {
* Remove the property at a location. This will override existing
* configuration data to have it conform to key/value mappings.
*
* @param path
* @param path a path
*/
@SuppressWarnings("unchecked")
public void removeProperty(String path) {
@ -800,4 +800,5 @@ public class YAMLNode {
public void setWriteDefaults(boolean writeDefaults) {
this.writeDefaults = writeDefaults;
}
}

Datei anzeigen

@ -32,6 +32,7 @@ import org.yaml.snakeyaml.representer.Representer;
import java.io.*;
import java.util.*;
import java.util.Map.Entry;
/**
* YAML configuration loader. To use this class, construct it with path to
@ -58,13 +59,11 @@ import java.util.*;
* babies: true</pre>
*
* <p>Calling code could access sturmeh's baby eating state by using
* <code>getBoolean("sturmeh.eats.babies", false)</code>. For lists, there are
* methods such as <code>getStringList</code> that will return a type safe list.
*
*
* @author sk89q
* {@code getBoolean("sturmeh.eats.babies", false)}. For lists, there are
* methods such as {@code getStringList} that will return a type safe list.
*/
public class YAMLProcessor extends YAMLNode {
public static final String LINE_BREAK = DumperOptions.LineBreak.getPlatformLineBreak().getString();
public static final char COMMENT_CHAR = '#';
protected final Yaml yaml;
@ -117,7 +116,7 @@ public class YAMLProcessor extends YAMLNode {
if (stream != null) {
stream.close();
}
} catch (IOException e) {
} catch (IOException ignored) {
}
}
}
@ -156,7 +155,7 @@ public class YAMLProcessor extends YAMLNode {
/**
* Return the set header.
*
* @return
* @return the header text
*/
public String getHeader() {
return header;
@ -184,13 +183,11 @@ public class YAMLProcessor extends YAMLNode {
writer.append(header);
writer.append(LINE_BREAK);
}
if (comments.size() == 0 || format != YAMLFormat.EXTENDED) {
if (comments.isEmpty() || format != YAMLFormat.EXTENDED) {
yaml.dump(root, writer);
} else {
// Iterate over each root-level property and dump
for (Iterator<Map.Entry<String, Object>> i = root.entrySet().iterator(); i.hasNext(); ) {
Map.Entry<String, Object> entry = i.next();
for (Entry<String, Object> entry : root.entrySet()) {
// Output comment, if present
String comment = comments.get(entry.getKey());
if (comment != null) {
@ -204,13 +201,13 @@ public class YAMLProcessor extends YAMLNode {
}
}
return true;
} catch (IOException e) {
} catch (IOException ignored) {
} finally {
try {
if (stream != null) {
stream.close();
}
} catch (IOException e) {}
} catch (IOException ignored) {}
}
return false;
@ -241,7 +238,7 @@ public class YAMLProcessor extends YAMLNode {
* Returns a root-level comment.
*
* @param key the property key
* @return the comment or <code>null</code>
* @return the comment or {@code null}
*/
public String getComment(String key) {
return comments.get(key);
@ -259,7 +256,7 @@ public class YAMLProcessor extends YAMLNode {
* Set a root-level comment.
*
* @param key the property key
* @param comment the comment. May be <code>null</code>, in which case the comment
* @param comment the comment. May be {@code null}, in which case the comment
* is removed.
*/
public void setComment(String key, String... comment) {
@ -300,7 +297,8 @@ public class YAMLProcessor extends YAMLNode {
/**
* This method returns an empty ConfigurationNode for using as a
* default in methods that select a node from a node list.
* @return
*
* @return a node
*/
public static YAMLNode getEmptyNode(boolean writeDefaults) {
return new YAMLNode(new LinkedHashMap<String, Object>(), writeDefaults);
@ -321,12 +319,14 @@ public class YAMLProcessor extends YAMLNode {
}
private static class FancyRepresenter extends Representer {
public FancyRepresenter() {
private FancyRepresenter() {
this.nullRepresenter = new Represent() {
@Override
public Node representData(Object o) {
return representScalar(Tag.NULL, "");
}
};
}
}
}

Datei anzeigen

@ -21,11 +21,8 @@ package com.sk89q.util.yaml;
/**
* YAMLProcessor exception.
*
* @author sk89q
*/
public class YAMLProcessorException extends Exception {
private static final long serialVersionUID = -2442886939908724203L;
public YAMLProcessorException() {
super();
@ -34,4 +31,5 @@ public class YAMLProcessorException extends Exception {
public YAMLProcessorException(String msg) {
super(msg);
}
}

Datei anzeigen

@ -174,7 +174,7 @@ public class CuboidClipboard {
final int shiftX = sizeRotated.getX() < 0 ? -sizeRotated.getBlockX() - 1 : 0;
final int shiftZ = sizeRotated.getZ() < 0 ? -sizeRotated.getBlockZ() - 1 : 0;
final BaseBlock newData[][][] = new BaseBlock
final BaseBlock[][][] newData = new BaseBlock
[Math.abs(sizeRotated.getBlockX())]
[Math.abs(sizeRotated.getBlockY())]
[Math.abs(sizeRotated.getBlockZ())];
@ -476,8 +476,9 @@ public class CuboidClipboard {
* @param position the point, relative to the origin of the copy (0, 0, 0) and not to the actual copy origin
* @return air, if this block was outside the (non-cuboid) selection while copying
* @throws ArrayIndexOutOfBoundsException if the position is outside the bounds of the CuboidClipboard
* @deprecated Use {@link #getBlock(Vector)} instead
* @deprecated use {@link #getBlock(Vector)} instead
*/
@Deprecated
public BaseBlock getPoint(Vector position) throws ArrayIndexOutOfBoundsException {
final BaseBlock block = getBlock(position);
if (block == null) {

Datei anzeigen

@ -80,6 +80,8 @@ import com.sk89q.worldedit.world.biome.BaseBiome;
import javax.annotation.Nullable;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
@ -96,6 +98,8 @@ import static com.sk89q.worldedit.regions.Regions.*;
@SuppressWarnings("FieldCanBeLocal")
public class EditSession implements Extent {
private static final Logger log = Logger.getLogger(EditSession.class.getCanonicalName());
/**
* Used by {@link #setBlock(Vector, BaseBlock, Stage)} to
* determine which {@link Extent}s should be bypassed.
@ -317,8 +321,9 @@ public class EditSession implements Extent {
/**
* Set whether fast mode is enabled.
* </p>
* Fast mode may skip lighting checks or adjacent block notification.
*
* <p>Fast mode may skip lighting checks or adjacent block
* notification.</p>
*
* @param enabled true to enable
*/
@ -330,13 +335,14 @@ public class EditSession implements Extent {
/**
* Return fast mode status.
* </p>
* Fast mode may skip lighting checks or adjacent block notification.
*
* <p>Fast mode may skip lighting checks or adjacent block
* notification.</p>
*
* @return true if enabled
*/
public boolean hasFastMode() {
return fastModeExtent != null ? fastModeExtent.isEnabled() : false;
return fastModeExtent != null && fastModeExtent.isEnabled();
}
/**
@ -369,8 +375,8 @@ public class EditSession implements Extent {
/**
* Get the number of blocks changed, including repeated block changes.
* </p>
* This number may not be accurate.
*
* <p>This number may not be accurate.</p>
*
* @return the number of block changes
*/
@ -1486,15 +1492,14 @@ public class EditSession implements Extent {
/**
* Makes a pyramid.
*
* @param pos
* @param block
* @param size
* @param filled
* @param position a position
* @param block a block
* @param size size of pyramid
* @param filled true if filled
* @return number of blocks changed
* @throws MaxChangedBlocksException
*/
public int makePyramid(Vector pos, Pattern block, int size,
boolean filled) throws MaxChangedBlocksException {
public int makePyramid(Vector position, Pattern block, int size, boolean filled) throws MaxChangedBlocksException {
int affected = 0;
int height = size;
@ -1506,16 +1511,16 @@ public class EditSession implements Extent {
if ((filled && z <= size && x <= size) || z == size || x == size) {
if (setBlock(pos.add(x, y, z), block)) {
if (setBlock(position.add(x, y, z), block)) {
++affected;
}
if (setBlock(pos.add(-x, y, z), block)) {
if (setBlock(position.add(-x, y, z), block)) {
++affected;
}
if (setBlock(pos.add(x, y, -z), block)) {
if (setBlock(position.add(x, y, -z), block)) {
++affected;
}
if (setBlock(pos.add(-x, y, -z), block)) {
if (setBlock(position.add(-x, y, -z), block)) {
++affected;
}
}
@ -1527,21 +1532,21 @@ public class EditSession implements Extent {
}
/**
* Thaw.
* Thaw blocks in a radius.
*
* @param pos
* @param radius
* @param position the position
* @param radius the radius
* @return number of blocks affected
* @throws MaxChangedBlocksException
*/
public int thaw(Vector pos, double radius)
public int thaw(Vector position, double radius)
throws MaxChangedBlocksException {
int affected = 0;
double radiusSq = radius * radius;
int ox = pos.getBlockX();
int oy = pos.getBlockY();
int oz = pos.getBlockZ();
int ox = position.getBlockX();
int oy = position.getBlockY();
int oz = position.getBlockZ();
BaseBlock air = new BaseBlock(0);
BaseBlock water = new BaseBlock(BlockID.STATIONARY_WATER);
@ -1549,7 +1554,7 @@ public class EditSession implements Extent {
int ceilRadius = (int) Math.ceil(radius);
for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) {
for (int z = oz - ceilRadius; z <= oz + ceilRadius; ++z) {
if ((new Vector(x, oy, z)).distanceSq(pos) > radiusSq) {
if ((new Vector(x, oy, z)).distanceSq(position) > radiusSq) {
continue;
}
@ -1586,21 +1591,20 @@ public class EditSession implements Extent {
}
/**
* Make snow.
* Make snow in a radius.
*
* @param pos
* @param radius
* @param position a position
* @param radius a radius
* @return number of blocks affected
* @throws MaxChangedBlocksException
*/
public int simulateSnow(Vector pos, double radius)
throws MaxChangedBlocksException {
public int simulateSnow(Vector position, double radius) throws MaxChangedBlocksException {
int affected = 0;
double radiusSq = radius * radius;
int ox = pos.getBlockX();
int oy = pos.getBlockY();
int oz = pos.getBlockZ();
int ox = position.getBlockX();
int oy = position.getBlockY();
int oz = position.getBlockZ();
BaseBlock ice = new BaseBlock(BlockID.ICE);
BaseBlock snow = new BaseBlock(BlockID.SNOW);
@ -1608,7 +1612,7 @@ public class EditSession implements Extent {
int ceilRadius = (int) Math.ceil(radius);
for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) {
for (int z = oz - ceilRadius; z <= oz + ceilRadius; ++z) {
if ((new Vector(x, oy, z)).distanceSq(pos) > radiusSq) {
if ((new Vector(x, oy, z)).distanceSq(position) > radiusSq) {
continue;
}
@ -1651,44 +1655,43 @@ public class EditSession implements Extent {
}
/**
* Green.
* Make dirt green.
*
* @param pos
* @param radius
* @param position a position
* @param radius a radius
* @return number of blocks affected
* @throws MaxChangedBlocksException
* @deprecated Use {@link #green(Vector, double, boolean)}.
*/
@Deprecated
public int green(Vector pos, double radius)
throws MaxChangedBlocksException {
return green(pos, radius, true);
public int green(Vector position, double radius) throws MaxChangedBlocksException {
return green(position, radius, true);
}
/**
* Green.
* Make dirt green.
*
* @param pos
* @param radius
* @param position a position
* @param radius a radius
* @param onlyNormalDirt only affect normal dirt (data value 0)
* @return number of blocks affected
* @throws MaxChangedBlocksException
*/
public int green(Vector pos, double radius, boolean onlyNormalDirt)
public int green(Vector position, double radius, boolean onlyNormalDirt)
throws MaxChangedBlocksException {
int affected = 0;
final double radiusSq = radius * radius;
final int ox = pos.getBlockX();
final int oy = pos.getBlockY();
final int oz = pos.getBlockZ();
final int ox = position.getBlockX();
final int oy = position.getBlockY();
final int oz = position.getBlockZ();
final BaseBlock grass = new BaseBlock(BlockID.GRASS);
final int ceilRadius = (int) Math.ceil(radius);
for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) {
for (int z = oz - ceilRadius; z <= oz + ceilRadius; ++z) {
if ((new Vector(x, oy, z)).distanceSq(pos) > radiusSq) {
if ((new Vector(x, oy, z)).distanceSq(position) > radiusSq) {
continue;
}
@ -1758,23 +1761,22 @@ public class EditSession implements Extent {
/**
* Makes a forest.
*
* @param basePos
* @param size
* @param density
* @param treeGenerator
* @param basePosition a position
* @param size a size
* @param density between 0 and 1, inclusive
* @param treeGenerator the tree genreator
* @return number of trees created
* @throws MaxChangedBlocksException
*/
public int makeForest(Vector basePos, int size, double density,
TreeGenerator treeGenerator) throws MaxChangedBlocksException {
public int makeForest(Vector basePosition, int size, double density, TreeGenerator treeGenerator) throws MaxChangedBlocksException {
int affected = 0;
for (int x = basePos.getBlockX() - size; x <= basePos.getBlockX()
for (int x = basePosition.getBlockX() - size; x <= basePosition.getBlockX()
+ size; ++x) {
for (int z = basePos.getBlockZ() - size; z <= basePos.getBlockZ()
for (int z = basePosition.getBlockZ() - size; z <= basePosition.getBlockZ()
+ size; ++z) {
// Don't want to be in the ground
if (!getBlock(new Vector(x, basePos.getBlockY(), z)).isAir()) {
if (!getBlock(new Vector(x, basePosition.getBlockY(), z)).isAir()) {
continue;
}
// The gods don't want a tree here
@ -1782,7 +1784,7 @@ public class EditSession implements Extent {
continue;
} // def 0.05
for (int y = basePos.getBlockY(); y >= basePos.getBlockY() - 10; --y) {
for (int y = basePosition.getBlockY(); y >= basePosition.getBlockY() - 10; --y) {
// Check if we hit the ground
int t = getBlock(new Vector(x, y, z)).getType();
if (t == BlockID.GRASS || t == BlockID.DIRT) {
@ -1804,8 +1806,8 @@ public class EditSession implements Extent {
/**
* Get the block distribution inside a region.
*
* @param region
* @return
* @param region a region
* @return the results
*/
public List<Countable<Integer>> getBlockDistribution(Region region) {
List<Countable<Integer>> distribution = new ArrayList<Countable<Integer>>();
@ -1862,8 +1864,8 @@ public class EditSession implements Extent {
/**
* Get the block distribution (with data values) inside a region.
*
* @param region
* @return
* @param region a region
* @return the results
*/
// TODO reduce code duplication - probably during ops-redux
public List<Countable<BaseBlock>> getBlockDistributionWithData(Region region) {
@ -1942,7 +1944,7 @@ public class EditSession implements Extent {
return new BaseBlock((int) typeVariable.getValue(), (int) dataVariable.getValue());
} catch (Exception e) {
e.printStackTrace();
log.log(Level.WARNING, "Failed to create shape", e);
return null;
}
}
@ -2161,12 +2163,12 @@ public class EditSession implements Extent {
throws MaxChangedBlocksException {
Set<Vector> vset = new HashSet<Vector>();
List<Node> nodes = new ArrayList(nodevectors.size());
List<Node> nodes = new ArrayList<Node>(nodevectors.size());
Interpolation interpol = new KochanekBartelsInterpolation();
for (int loop = 0; loop < nodevectors.size(); loop++) {
Node n = new Node(nodevectors.get(loop));
for (Vector nodevector : nodevectors) {
Node n = new Node(nodevector);
n.setTension(tension);
n.setBias(bias);
n.setContinuity(continuity);
@ -2285,7 +2287,7 @@ public class EditSession implements Extent {
// TODO: Allow biome setting via a script variable (needs BiomeType<->int mapping)
return defaultBiomeType;
} catch (Exception e) {
e.printStackTrace();
log.log(Level.WARNING, "Failed to create shape", e);
return null;
}
}
@ -2303,11 +2305,11 @@ public class EditSession implements Extent {
PlayerDirection.DOWN.vector(),
};
private static final double lengthSq(double x, double y, double z) {
private static double lengthSq(double x, double y, double z) {
return (x * x) + (y * y) + (z * z);
}
private static final double lengthSq(double x, double z) {
private static double lengthSq(double x, double z) {
return (x * x) + (z * z);
}

Datei anzeigen

@ -107,7 +107,7 @@ public class Location {
@Override
public String toString() {
return "World: " + world.getName() + ", Coordinates: " + position.toString()
return "World: " + world.getName() + ", Coordinates: " + position
+ ", Yaw: " + yaw + ", Pitch: " + pitch;
}

Datei anzeigen

@ -39,9 +39,9 @@ public enum PlayerDirection {
UP(new Vector(0, 1, 0), new Vector(0, 0, 1), true),
DOWN(new Vector(0, -1, 0), new Vector(0, 0, 1), true);
private Vector dir;
private Vector leftDir;
private boolean isOrthogonal;
private final Vector dir;
private final Vector leftDir;
private final boolean isOrthogonal;
PlayerDirection(Vector vec, Vector leftDir, boolean isOrthogonal) {
this.dir = vec;

Datei anzeigen

@ -49,9 +49,9 @@ public enum VectorFace {
BELOW_EAST(DOWN, EAST),
SELF(0, 0, 0);
private int modX;
private int modY;
private int modZ;
private final int modX;
private final int modY;
private final int modZ;
private VectorFace(final int modX, final int modY, final int modZ) {
this.modX = modX;

Datei anzeigen

@ -62,6 +62,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import static com.google.common.base.Preconditions.checkNotNull;
@ -761,7 +762,7 @@ public class WorldEdit {
} catch (ScriptException e) {
player.printError("Failed to execute:");
player.printRaw(e.getMessage());
e.printStackTrace();
logger.log(Level.WARNING, "Failed to execute script", e);
} catch (NumberFormatException e) {
throw e;
} catch (WorldEditException e) {
@ -769,7 +770,7 @@ public class WorldEdit {
} catch (Throwable e) {
player.printError("Failed to execute (see console):");
player.printRaw(e.getClass().getCanonicalName());
e.printStackTrace();
logger.log(Level.WARNING, "Failed to execute script", e);
} finally {
for (EditSession editSession : scriptContext.getEditSessions()) {
editSession.flushQueue();

Datei anzeigen

@ -25,20 +25,19 @@ import com.sk89q.worldedit.world.World;
/**
* @deprecated Use {@link com.sk89q.worldedit.util.Location} wherever possible
*/
@SuppressWarnings("deprecation")
@Deprecated
public class WorldVector extends Vector {
/**
* Represents the world.
*/
private LocalWorld world;
/**
* Construct the Vector object.
*
* @param world
* @param x
* @param y
* @param z
* @param world a world
* @param x the X coordinate
* @param y the Y coordinate
* @param z the Z coordinate
*/
public WorldVector(LocalWorld world, double x, double y, double z) {
super(x, y, z);
@ -48,10 +47,10 @@ public class WorldVector extends Vector {
/**
* Construct the Vector object.
*
* @param world
* @param x
* @param y
* @param z
* @param world a world
* @param x the X coordinate
* @param y the Y coordinate
* @param z the Z coordinate
*/
public WorldVector(LocalWorld world, int x, int y, int z) {
super(x, y, z);
@ -61,10 +60,10 @@ public class WorldVector extends Vector {
/**
* Construct the Vector object.
*
* @param world
* @param x
* @param y
* @param z
* @param world a world
* @param x the X coordinate
* @param y the Y coordinate
* @param z the Z coordinate
*/
public WorldVector(LocalWorld world, float x, float y, float z) {
super(x, y, z);
@ -74,18 +73,18 @@ public class WorldVector extends Vector {
/**
* Construct the Vector object.
*
* @param world
* @param pt
* @param world a world
* @param other the position to copy
*/
public WorldVector(LocalWorld world, Vector pt) {
super(pt);
public WorldVector(LocalWorld world, Vector other) {
super(other);
this.world = world;
}
/**
* Construct the Vector object.
*
* @param world
* @param world a world
*/
public WorldVector(LocalWorld world) {
super();
@ -104,7 +103,7 @@ public class WorldVector extends Vector {
/**
* Get the world.
*
* @return
* @return the world
*/
public LocalWorld getWorld() {
return world;
@ -112,11 +111,11 @@ public class WorldVector extends Vector {
/**
* Get a block point from a point.
*
* @param world
* @param x
* @param y
* @param z
*
* @param world a world
* @param x the X coordinate
* @param y the Y coordinate
* @param z the Z coordinate
* @return point
*/
public static WorldVector toBlockPoint(LocalWorld world, double x, double y,
@ -136,7 +135,7 @@ public class WorldVector extends Vector {
}
/**
* Return this object as a new preferred <code>Location</code>
* Return this object as a new preferred {@code Location}
* object.
*
* @return a new location object

Datei anzeigen

@ -56,12 +56,6 @@ public class WorldVector2D extends Vector2D {
return world;
}
/**
* Checks if another object is equivalent.
*
* @param obj
* @return whether the other object is equivalent
*/
@Override
public boolean equals(Object obj) {
if (!(obj instanceof WorldVector2D)) {

Datei anzeigen

@ -22,71 +22,32 @@ package com.sk89q.worldedit;
/**
* @deprecated Use {@link com.sk89q.worldedit.util.Location} wherever possible
*/
@SuppressWarnings("deprecation")
@Deprecated
public class WorldVectorFace extends WorldVector {
private VectorFace face;
/**
* Construct the Vector object.
*
* @param world
* @param x
* @param y
* @param z
* @param face
*/
public WorldVectorFace(LocalWorld world, double x, double y, double z, VectorFace face) {
super(world, x, y, z);
this.face = face;
}
/**
* Construct the Vector object.
*
* @param world
* @param x
* @param y
* @param z
* @param face
*/
public WorldVectorFace(LocalWorld world, int x, int y, int z, VectorFace face) {
super(world, x, y, z);
this.face = face;
}
/**
* Construct the Vector object.
*
* @param world
* @param x
* @param y
* @param z
* @param face
*/
public WorldVectorFace(LocalWorld world, float x, float y, float z, VectorFace face) {
super(world, x, y, z);
this.face = face;
}
/**
* Construct the Vector object.
*
* @param world
* @param pt
* @param face
*/
public WorldVectorFace(LocalWorld world, Vector pt, VectorFace face) {
super(world, pt);
this.face = face;
}
/**
* Construct the Vector object.
*
* @param world
* @param face
*/
public WorldVectorFace(LocalWorld world, VectorFace face) {
super(world);
this.face = face;
@ -95,7 +56,7 @@ public class WorldVectorFace extends WorldVector {
/**
* Get the face.
*
* @return
* @return the face
*/
public VectorFace getFace() {
return face;
@ -104,7 +65,7 @@ public class WorldVectorFace extends WorldVector {
/**
* Get the WorldVector adjacent to this WorldVectorFace.
*
* @return
* @return the face vector
*/
public WorldVector getFaceVector() {
return new WorldVector(getWorld(),
@ -120,7 +81,7 @@ public class WorldVectorFace extends WorldVector {
* @param world the world in which the resulting vector should lie
* @param vector the original vector
* @param face the direction in which the face should lie
* @return
* @return a face
*/
public static WorldVectorFace getWorldVectorFace(LocalWorld world, Vector vector, Vector face) {
if (vector == null || face == null) return null;

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen