mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-23 00:21:31 +01:00
changes
This commit is contained in:
parent
ada0262ce4
commit
afbcc86030
@ -6,7 +6,7 @@ import net.citizensnpcs.api.trait.trait.Owner;
|
||||
import net.citizensnpcs.api.trait.trait.SpawnLocation;
|
||||
import net.citizensnpcs.editor.Editor;
|
||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||
import net.citizensnpcs.resource.lib.EntityHumanNPC;
|
||||
import net.citizensnpcs.npc.entity.EntityHumanNPC;
|
||||
import net.citizensnpcs.trait.text.Text;
|
||||
import net.citizensnpcs.util.Messaging;
|
||||
|
||||
|
@ -35,8 +35,6 @@ public class CitizensTraitManager implements TraitManager {
|
||||
registerTrait(new TraitFactory(Waypoints.class).withName("waypoints"));
|
||||
}
|
||||
|
||||
// TODO: Code duplication? Yes. But don't change it unless you test to make
|
||||
// sure it builds AND works.
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T extends Trait> T getTrait(String name, NPC npc) {
|
||||
|
@ -4,7 +4,6 @@ import net.citizensnpcs.api.exception.NPCLoadException;
|
||||
import net.citizensnpcs.api.util.DataKey;
|
||||
import net.citizensnpcs.npc.CitizensNPC;
|
||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||
import net.citizensnpcs.resource.lib.EntityHumanNPC;
|
||||
import net.citizensnpcs.util.StringHelper;
|
||||
|
||||
import net.minecraft.server.EntityLiving;
|
||||
|
@ -1,9 +1,12 @@
|
||||
package net.citizensnpcs.resource.lib;
|
||||
package net.citizensnpcs.npc.entity;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Map;
|
||||
|
||||
import net.citizensnpcs.npc.network.NPCNetHandler;
|
||||
import net.citizensnpcs.npc.network.NPCNetworkManager;
|
||||
import net.citizensnpcs.npc.network.NPCSocket;
|
||||
import net.citizensnpcs.util.Messaging;
|
||||
import net.minecraft.server.EntityPlayer;
|
||||
import net.minecraft.server.ItemInWorldManager;
|
@ -1,4 +1,4 @@
|
||||
package net.citizensnpcs.resource.lib;
|
||||
package net.citizensnpcs.npc.network;
|
||||
|
||||
import net.minecraft.server.EntityPlayer;
|
||||
import net.minecraft.server.MinecraftServer;
|
@ -1,4 +1,4 @@
|
||||
package net.citizensnpcs.resource.lib;
|
||||
package net.citizensnpcs.npc.network;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.Socket;
|
@ -1,4 +1,4 @@
|
||||
package net.citizensnpcs.resource.lib;
|
||||
package net.citizensnpcs.npc.network;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
@ -5,10 +5,10 @@ import java.util.List;
|
||||
|
||||
import net.citizensnpcs.api.ai.NavigationCallback;
|
||||
import net.citizensnpcs.api.util.DataKey;
|
||||
import net.citizensnpcs.api.util.StorageUtils;
|
||||
import net.citizensnpcs.editor.Editor;
|
||||
import net.citizensnpcs.util.Messaging;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -70,7 +70,10 @@ public class LinearWaypointProvider implements WaypointProvider, Iterable<Waypoi
|
||||
@Override
|
||||
public void load(DataKey key) {
|
||||
for (DataKey root : key.getRelative("waypoints").getIntegerSubKeys()) {
|
||||
waypoints.add(new Waypoint(StorageUtils.loadLocation(root)));
|
||||
root = root.getRelative("location");
|
||||
waypoints.add(new Waypoint(new Location(Bukkit.getWorld(root.getString("world")), root.getDouble("x"), root
|
||||
.getDouble("y"), root.getDouble("z"), (float) root.getDouble("yaw", 0), (float) root.getDouble(
|
||||
"pitch", 0))));
|
||||
}
|
||||
callback.onProviderChanged();
|
||||
}
|
||||
@ -79,7 +82,14 @@ public class LinearWaypointProvider implements WaypointProvider, Iterable<Waypoi
|
||||
public void save(DataKey key) {
|
||||
key = key.getRelative("waypoints");
|
||||
for (int i = 0; i < waypoints.size(); ++i) {
|
||||
StorageUtils.saveLocation(key.getRelative(Integer.toString(i)), waypoints.get(i).getLocation());
|
||||
Location location = waypoints.get(i).getLocation();
|
||||
key = key.getRelative(Integer.toString(i) + ".location");
|
||||
key.setString("world", location.getWorld().getName());
|
||||
key.setDouble("x", location.getX());
|
||||
key.setDouble("y", location.getY());
|
||||
key.setDouble("z", location.getZ());
|
||||
key.setDouble("yaw", location.getYaw());
|
||||
key.setDouble("pitch", location.getPitch());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user