SPIGOT-6242: Fix some file line endings

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2020-11-18 08:13:04 +11:00
parent 658c0a284a
commit 7dd38ec039
3 changed files with 268 additions and 268 deletions

View file

@ -1,110 +1,110 @@
package org.bukkit.craftbukkit.util;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
public abstract class LazyHashSet<E> implements Set<E> {
Set<E> reference = null;
@Override
public int size() {
return getReference().size();
}
@Override
public boolean isEmpty() {
return getReference().isEmpty();
}
@Override
public boolean contains(Object o) {
return getReference().contains(o);
}
@Override
public Iterator<E> iterator() {
return getReference().iterator();
}
@Override
public Object[] toArray() {
return getReference().toArray();
}
@Override
public <T> T[] toArray(T[] a) {
return getReference().toArray(a);
}
@Override
public boolean add(E o) {
return getReference().add(o);
}
@Override
public boolean remove(Object o) {
return getReference().remove(o);
}
@Override
public boolean containsAll(Collection<?> c) {
return getReference().containsAll(c);
}
@Override
public boolean addAll(Collection<? extends E> c) {
return getReference().addAll(c);
}
@Override
public boolean retainAll(Collection<?> c) {
return getReference().retainAll(c);
}
@Override
public boolean removeAll(Collection<?> c) {
return getReference().removeAll(c);
}
@Override
public void clear() {
getReference().clear();
}
public Set<E> getReference() {
Set<E> reference = this.reference;
if (reference != null) {
return reference;
}
return this.reference = makeReference();
}
abstract Set<E> makeReference();
public boolean isLazy() {
return reference == null;
}
@Override
public int hashCode() {
return 157 * getReference().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj == null || this.getClass() != obj.getClass()) {
return false;
}
LazyHashSet<?> that = (LazyHashSet<?>) obj;
return (this.isLazy() && that.isLazy()) || this.getReference().equals(that.getReference());
}
@Override
public String toString() {
return getReference().toString();
}
}
package org.bukkit.craftbukkit.util;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
public abstract class LazyHashSet<E> implements Set<E> {
Set<E> reference = null;
@Override
public int size() {
return getReference().size();
}
@Override
public boolean isEmpty() {
return getReference().isEmpty();
}
@Override
public boolean contains(Object o) {
return getReference().contains(o);
}
@Override
public Iterator<E> iterator() {
return getReference().iterator();
}
@Override
public Object[] toArray() {
return getReference().toArray();
}
@Override
public <T> T[] toArray(T[] a) {
return getReference().toArray(a);
}
@Override
public boolean add(E o) {
return getReference().add(o);
}
@Override
public boolean remove(Object o) {
return getReference().remove(o);
}
@Override
public boolean containsAll(Collection<?> c) {
return getReference().containsAll(c);
}
@Override
public boolean addAll(Collection<? extends E> c) {
return getReference().addAll(c);
}
@Override
public boolean retainAll(Collection<?> c) {
return getReference().retainAll(c);
}
@Override
public boolean removeAll(Collection<?> c) {
return getReference().removeAll(c);
}
@Override
public void clear() {
getReference().clear();
}
public Set<E> getReference() {
Set<E> reference = this.reference;
if (reference != null) {
return reference;
}
return this.reference = makeReference();
}
abstract Set<E> makeReference();
public boolean isLazy() {
return reference == null;
}
@Override
public int hashCode() {
return 157 * getReference().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj == null || this.getClass() != obj.getClass()) {
return false;
}
LazyHashSet<?> that = (LazyHashSet<?>) obj;
return (this.isLazy() && that.isLazy()) || this.getReference().equals(that.getReference());
}
@Override
public String toString() {
return getReference().toString();
}
}

View file

@ -1,40 +1,40 @@
package org.bukkit.craftbukkit.util.permissions;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import org.bukkit.util.permissions.DefaultPermissions;
public final class CommandPermissions {
private static final String ROOT = "minecraft.command";
private static final String PREFIX = ROOT + ".";
private CommandPermissions() {}
public static Permission registerPermissions(Permission parent) {
Permission commands = DefaultPermissions.registerPermission(ROOT, "Gives the user the ability to use all vanilla minecraft commands", parent);
DefaultPermissions.registerPermission(PREFIX + "kill", "Allows the user to commit suicide", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "me", "Allows the user to perform a chat action", PermissionDefault.TRUE, commands);
DefaultPermissions.registerPermission(PREFIX + "msg", "Allows the user to privately message another player", PermissionDefault.TRUE, commands);
DefaultPermissions.registerPermission(PREFIX + "help", "Allows the user to access Vanilla command help", PermissionDefault.TRUE, commands);
DefaultPermissions.registerPermission(PREFIX + "say", "Allows the user to talk as the console", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "give", "Allows the user to give items to players", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "teleport", "Allows the user to teleport players", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "kick", "Allows the user to kick players", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "stop", "Allows the user to stop the server", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "list", "Allows the user to list all online players", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "gamemode", "Allows the user to change the gamemode of another player", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "xp", "Allows the user to give themselves or others arbitrary values of experience", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "toggledownfall", "Allows the user to toggle rain on/off for a given world", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "defaultgamemode", "Allows the user to change the default gamemode of the server", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "seed", "Allows the user to view the seed of the world", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "effect", "Allows the user to add/remove effects on players", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "selector", "Allows the use of selectors", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "trigger", "Allows the use of the trigger command", PermissionDefault.TRUE, commands);
DefaultPermissions.registerPermission("minecraft.admin.command_feedback", "Receive command broadcasts when sendCommandFeedback is true", PermissionDefault.OP, commands);
commands.recalculatePermissibles();
return commands;
}
}
package org.bukkit.craftbukkit.util.permissions;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import org.bukkit.util.permissions.DefaultPermissions;
public final class CommandPermissions {
private static final String ROOT = "minecraft.command";
private static final String PREFIX = ROOT + ".";
private CommandPermissions() {}
public static Permission registerPermissions(Permission parent) {
Permission commands = DefaultPermissions.registerPermission(ROOT, "Gives the user the ability to use all vanilla minecraft commands", parent);
DefaultPermissions.registerPermission(PREFIX + "kill", "Allows the user to commit suicide", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "me", "Allows the user to perform a chat action", PermissionDefault.TRUE, commands);
DefaultPermissions.registerPermission(PREFIX + "msg", "Allows the user to privately message another player", PermissionDefault.TRUE, commands);
DefaultPermissions.registerPermission(PREFIX + "help", "Allows the user to access Vanilla command help", PermissionDefault.TRUE, commands);
DefaultPermissions.registerPermission(PREFIX + "say", "Allows the user to talk as the console", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "give", "Allows the user to give items to players", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "teleport", "Allows the user to teleport players", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "kick", "Allows the user to kick players", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "stop", "Allows the user to stop the server", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "list", "Allows the user to list all online players", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "gamemode", "Allows the user to change the gamemode of another player", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "xp", "Allows the user to give themselves or others arbitrary values of experience", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "toggledownfall", "Allows the user to toggle rain on/off for a given world", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "defaultgamemode", "Allows the user to change the default gamemode of the server", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "seed", "Allows the user to view the seed of the world", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "effect", "Allows the user to add/remove effects on players", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "selector", "Allows the use of selectors", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "trigger", "Allows the use of the trigger command", PermissionDefault.TRUE, commands);
DefaultPermissions.registerPermission("minecraft.admin.command_feedback", "Receive command broadcasts when sendCommandFeedback is true", PermissionDefault.OP, commands);
commands.recalculatePermissibles();
return commands;
}
}

View file

@ -1,118 +1,118 @@
package org.bukkit.support;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.HashMap;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.Server;
import org.bukkit.craftbukkit.CraftLootTable;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.inventory.CraftItemFactory;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.craftbukkit.util.Versioning;
public final class DummyServer implements InvocationHandler {
private static interface MethodHandler {
Object handle(DummyServer server, Object[] args);
}
private static final HashMap<Method, MethodHandler> methods = new HashMap<Method, MethodHandler>();
static {
try {
methods.put(
Server.class.getMethod("getItemFactory"),
new MethodHandler() {
@Override
public Object handle(DummyServer server, Object[] args) {
return CraftItemFactory.instance();
}
}
);
methods.put(
Server.class.getMethod("getName"),
new MethodHandler() {
@Override
public Object handle(DummyServer server, Object[] args) {
return DummyServer.class.getName();
}
}
);
methods.put(
Server.class.getMethod("getVersion"),
new MethodHandler() {
@Override
public Object handle(DummyServer server, Object[] args) {
return DummyServer.class.getPackage().getImplementationVersion();
}
}
);
methods.put(
Server.class.getMethod("getBukkitVersion"),
new MethodHandler() {
@Override
public Object handle(DummyServer server, Object[] args) {
return Versioning.getBukkitVersion();
}
}
);
methods.put(
Server.class.getMethod("getLogger"),
new MethodHandler() {
final Logger logger = Logger.getLogger(DummyServer.class.getCanonicalName());
@Override
public Object handle(DummyServer server, Object[] args) {
return logger;
}
}
);
methods.put(
Server.class.getMethod("getUnsafe"),
new MethodHandler() {
@Override
public Object handle(DummyServer server, Object[] args) {
return CraftMagicNumbers.INSTANCE;
}
}
);
methods.put(
Server.class.getMethod("createBlockData", Material.class),
new MethodHandler() {
final Logger logger = Logger.getLogger(DummyServer.class.getCanonicalName());
@Override
public Object handle(DummyServer server, Object[] args) {
return CraftBlockData.newData((Material) args[0], null);
}
}
);
methods.put(Server.class.getMethod("getLootTable", NamespacedKey.class),
new MethodHandler() {
@Override
public Object handle(DummyServer server, Object[] args) {
NamespacedKey key = (NamespacedKey) args[0];
return new CraftLootTable(key, AbstractTestingBase.LOOT_TABLE_REGISTRY.getLootTable(CraftNamespacedKey.toMinecraft(key)));
}
}
);
Bukkit.setServer(Proxy.getProxyClass(Server.class.getClassLoader(), Server.class).asSubclass(Server.class).getConstructor(InvocationHandler.class).newInstance(new DummyServer()));
} catch (Throwable t) {
throw new Error(t);
}
}
public static void setup() {}
private DummyServer() {};
@Override
public Object invoke(Object proxy, Method method, Object[] args) {
MethodHandler handler = methods.get(method);
if (handler != null) {
return handler.handle(this, args);
}
throw new UnsupportedOperationException(String.valueOf(method));
}
}
package org.bukkit.support;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.HashMap;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.Server;
import org.bukkit.craftbukkit.CraftLootTable;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.inventory.CraftItemFactory;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.craftbukkit.util.Versioning;
public final class DummyServer implements InvocationHandler {
private static interface MethodHandler {
Object handle(DummyServer server, Object[] args);
}
private static final HashMap<Method, MethodHandler> methods = new HashMap<Method, MethodHandler>();
static {
try {
methods.put(
Server.class.getMethod("getItemFactory"),
new MethodHandler() {
@Override
public Object handle(DummyServer server, Object[] args) {
return CraftItemFactory.instance();
}
}
);
methods.put(
Server.class.getMethod("getName"),
new MethodHandler() {
@Override
public Object handle(DummyServer server, Object[] args) {
return DummyServer.class.getName();
}
}
);
methods.put(
Server.class.getMethod("getVersion"),
new MethodHandler() {
@Override
public Object handle(DummyServer server, Object[] args) {
return DummyServer.class.getPackage().getImplementationVersion();
}
}
);
methods.put(
Server.class.getMethod("getBukkitVersion"),
new MethodHandler() {
@Override
public Object handle(DummyServer server, Object[] args) {
return Versioning.getBukkitVersion();
}
}
);
methods.put(
Server.class.getMethod("getLogger"),
new MethodHandler() {
final Logger logger = Logger.getLogger(DummyServer.class.getCanonicalName());
@Override
public Object handle(DummyServer server, Object[] args) {
return logger;
}
}
);
methods.put(
Server.class.getMethod("getUnsafe"),
new MethodHandler() {
@Override
public Object handle(DummyServer server, Object[] args) {
return CraftMagicNumbers.INSTANCE;
}
}
);
methods.put(
Server.class.getMethod("createBlockData", Material.class),
new MethodHandler() {
final Logger logger = Logger.getLogger(DummyServer.class.getCanonicalName());
@Override
public Object handle(DummyServer server, Object[] args) {
return CraftBlockData.newData((Material) args[0], null);
}
}
);
methods.put(Server.class.getMethod("getLootTable", NamespacedKey.class),
new MethodHandler() {
@Override
public Object handle(DummyServer server, Object[] args) {
NamespacedKey key = (NamespacedKey) args[0];
return new CraftLootTable(key, AbstractTestingBase.LOOT_TABLE_REGISTRY.getLootTable(CraftNamespacedKey.toMinecraft(key)));
}
}
);
Bukkit.setServer(Proxy.getProxyClass(Server.class.getClassLoader(), Server.class).asSubclass(Server.class).getConstructor(InvocationHandler.class).newInstance(new DummyServer()));
} catch (Throwable t) {
throw new Error(t);
}
}
public static void setup() {}
private DummyServer() {};
@Override
public Object invoke(Object proxy, Method method, Object[] args) {
MethodHandler handler = methods.get(method);
if (handler != null) {
return handler.handle(this, args);
}
throw new UnsupportedOperationException(String.valueOf(method));
}
}