mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-25 18:47:40 +01:00
use spaces
This commit is contained in:
parent
7fea467676
commit
d5df854e5a
@ -13,7 +13,8 @@
|
|||||||
|
|
||||||
<!-- Compile the code -->
|
<!-- Compile the code -->
|
||||||
<target name="dist" depends="init" description="compile the source">
|
<target name="dist" depends="init" description="compile the source">
|
||||||
<javac srcdir="${src}" destdir="${build}" debug="on" debuglevel="lines,vars,source" includeantruntime="false" encoding="Cp1252">
|
<javac srcdir="${src}" destdir="${build}" debug="on"
|
||||||
|
debuglevel="lines,vars,source" includeantruntime="false" encoding="Cp1252">
|
||||||
<classpath>
|
<classpath>
|
||||||
<pathelement path="${lib}" />
|
<pathelement path="${lib}" />
|
||||||
<pathelement location="${lib}/bukkit-1.1-R1-SNAPSHOT.jar" />
|
<pathelement location="${lib}/bukkit-1.1-R1-SNAPSHOT.jar" />
|
||||||
|
@ -27,7 +27,7 @@ public class EventListen implements Listener {
|
|||||||
/*
|
/*
|
||||||
* Entity events
|
* Entity events
|
||||||
*/
|
*/
|
||||||
@EventHandler()
|
@EventHandler
|
||||||
public void onEntityDamage(EntityDamageEvent event) {
|
public void onEntityDamage(EntityDamageEvent event) {
|
||||||
if (event.isCancelled() || !CitizensAPI.getNPCManager().isNPC(event.getEntity()))
|
if (event.isCancelled() || !CitizensAPI.getNPCManager().isNPC(event.getEntity()))
|
||||||
return;
|
return;
|
||||||
@ -41,7 +41,7 @@ public class EventListen implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler()
|
@EventHandler
|
||||||
public void onEntityTarget(EntityTargetEvent event) {
|
public void onEntityTarget(EntityTargetEvent event) {
|
||||||
if (event.isCancelled() || !CitizensAPI.getNPCManager().isNPC(event.getEntity())
|
if (event.isCancelled() || !CitizensAPI.getNPCManager().isNPC(event.getEntity())
|
||||||
|| !(event.getTarget() instanceof Player))
|
|| !(event.getTarget() instanceof Player))
|
||||||
@ -54,7 +54,7 @@ public class EventListen implements Listener {
|
|||||||
/*
|
/*
|
||||||
* World events
|
* World events
|
||||||
*/
|
*/
|
||||||
@EventHandler()
|
@EventHandler
|
||||||
public void onChunkLoad(ChunkLoadEvent event) {
|
public void onChunkLoad(ChunkLoadEvent event) {
|
||||||
for (int id : toRespawn) {
|
for (int id : toRespawn) {
|
||||||
NPC npc = CitizensAPI.getNPCManager().getNPC(id);
|
NPC npc = CitizensAPI.getNPCManager().getNPC(id);
|
||||||
@ -63,7 +63,7 @@ public class EventListen implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler()
|
@EventHandler
|
||||||
public void onChunkUnload(ChunkUnloadEvent event) {
|
public void onChunkUnload(ChunkUnloadEvent event) {
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
return;
|
return;
|
||||||
|
@ -129,7 +129,7 @@ public class CitizensNPC implements NPC {
|
|||||||
@Override
|
@Override
|
||||||
public void spawn(Location loc) {
|
public void spawn(Location loc) {
|
||||||
if (isSpawned()) {
|
if (isSpawned()) {
|
||||||
System.out.println("The NPC is already spawned.");
|
Messaging.debug("The NPC is already spawned.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ public class CitizensNPC implements NPC {
|
|||||||
@Override
|
@Override
|
||||||
public void despawn() {
|
public void despawn() {
|
||||||
if (!isSpawned()) {
|
if (!isSpawned()) {
|
||||||
System.out.println("The NPC is already despawned.");
|
Messaging.debug("The NPC is already despawned.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,15 +171,10 @@ public class CitizensNPC implements NPC {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class Factory {
|
private class Factory {
|
||||||
private final Map<Class<? extends Trait>, Trait> created = new HashMap<Class<? extends Trait>, Trait>();
|
|
||||||
|
|
||||||
public <T extends Trait> T create(Class<T> clazz) {
|
public <T extends Trait> T create(Class<T> clazz) {
|
||||||
if (created.containsKey(clazz)) {
|
|
||||||
return clazz.cast(created.get(clazz));
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
Trait trait = clazz.newInstance();
|
Trait trait = clazz.newInstance();
|
||||||
created.put(clazz, trait);
|
|
||||||
return clazz.cast(trait);
|
return clazz.cast(trait);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
@ -13,7 +13,7 @@ public class NPCNetworkManager extends NetworkManager {
|
|||||||
super(socket, string, netHandler);
|
super(socket, string, netHandler);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// the field above the 3 synchronized lists.
|
// the field above the 3 synchronized lists
|
||||||
Field f = NetworkManager.class.getDeclaredField("l");
|
Field f = NetworkManager.class.getDeclaredField("l");
|
||||||
f.setAccessible(true);
|
f.setAccessible(true);
|
||||||
f.set(this, false);
|
f.set(this, false);
|
||||||
|
Loading…
Reference in New Issue
Block a user