mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-09-28 23:27:40 +02:00
more formatting again
This commit is contained in:
parent
4341327c3c
commit
596fa0e74b
@ -34,7 +34,7 @@ public class EventListen implements Listener {
|
|||||||
if (!manager.isNPC(event.getEntity()))
|
if (!manager.isNPC(event.getEntity()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.setCancelled(true); // TODO: implement damage handlers
|
event.setCancelled(true);
|
||||||
if (event instanceof EntityDamageByEntityEvent) {
|
if (event instanceof EntityDamageByEntityEvent) {
|
||||||
EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event;
|
EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event;
|
||||||
if (e.getDamager() instanceof Player) {
|
if (e.getDamager() instanceof Player) {
|
||||||
|
@ -52,14 +52,13 @@ public class Settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final YamlStorage config;
|
private final YamlStorage config;
|
||||||
private final DataKey root;
|
|
||||||
|
|
||||||
public Settings(Citizens plugin) {
|
public Settings(Citizens plugin) {
|
||||||
config = new YamlStorage(plugin.getDataFolder() + File.separator + "config.yml");
|
config = new YamlStorage(plugin.getDataFolder() + File.separator + "config.yml");
|
||||||
root = config.getKey("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load() {
|
public void load() {
|
||||||
|
DataKey root = config.getKey("");
|
||||||
for (Setting setting : Setting.values()) {
|
for (Setting setting : Setting.values()) {
|
||||||
if (!root.keyExists(setting.getPath())) {
|
if (!root.keyExists(setting.getPath())) {
|
||||||
Messaging.log("Writing default setting: '" + setting.getPath() + "'");
|
Messaging.log("Writing default setting: '" + setting.getPath() + "'");
|
||||||
|
@ -16,7 +16,7 @@ public class ByIdArray<T> implements Iterable<T> {
|
|||||||
|
|
||||||
public ByIdArray(int capacity) {
|
public ByIdArray(int capacity) {
|
||||||
if (capacity < 0)
|
if (capacity < 0)
|
||||||
throw new IllegalArgumentException("illegal capacity");
|
throw new IllegalArgumentException("Illegal capacity: cannot be below 0.");
|
||||||
elementData = new Object[capacity];
|
elementData = new Object[capacity];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,14 +49,6 @@ public class ByIdArray<T> implements Iterable<T> {
|
|||||||
return (T) elementData[index];
|
return (T) elementData[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @SuppressWarnings("unchecked") public T[] toArray(T[] a) { if (a.length <
|
|
||||||
* size) // Make a new array of a's runtime type, but my contents: return
|
|
||||||
* (T[]) Arrays.copyOf(elementData, size, a.getClass());
|
|
||||||
* System.arraycopy(elementData, 0, a, 0, size); if (a.length > size)
|
|
||||||
* a[size] = null; return a; }
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator<T> iterator() {
|
public Iterator<T> iterator() {
|
||||||
return new Iterator<T>() {
|
return new Iterator<T>() {
|
||||||
@ -73,9 +65,9 @@ public class ByIdArray<T> implements Iterable<T> {
|
|||||||
T next = (T) elementData[idx];
|
T next = (T) elementData[idx];
|
||||||
if (next == null || idx > highest)
|
if (next == null || idx > highest)
|
||||||
throw new NoSuchElementException();
|
throw new NoSuchElementException();
|
||||||
do {
|
do
|
||||||
idx++;
|
idx++;
|
||||||
} while (idx != highest + 1 && elementData[idx] == null);
|
while (idx != highest + 1 && elementData[idx] == null);
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +80,7 @@ public class ByIdArray<T> implements Iterable<T> {
|
|||||||
|
|
||||||
public void put(int index, T t) {
|
public void put(int index, T t) {
|
||||||
if (t == null)
|
if (t == null)
|
||||||
throw new IllegalArgumentException("t cannot be null");
|
throw new IllegalArgumentException("'t' cannot be null.");
|
||||||
++modCount;
|
++modCount;
|
||||||
if (index > highest)
|
if (index > highest)
|
||||||
highest = index;
|
highest = index;
|
||||||
|
Loading…
Reference in New Issue
Block a user