mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-23 02:55:45 +01:00
Preliminary update to MC 1.6.1: NOTE THAT PLAYER PATHFINDING DOES NOT WORK FULLY YET
This commit is contained in:
parent
73ec77eaa0
commit
df97053e91
27
pom.xml
27
pom.xml
@ -6,13 +6,13 @@
|
|||||||
|
|
||||||
<groupId>net.citizensnpcs</groupId>
|
<groupId>net.citizensnpcs</groupId>
|
||||||
<artifactId>citizens</artifactId>
|
<artifactId>citizens</artifactId>
|
||||||
<version>2.0.8-SNAPSHOT</version>
|
<version>2.0.9-SNAPSHOT</version>
|
||||||
<name>Citizens</name>
|
<name>Citizens</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<craftbukkit.version>1.5.2-R0.1-SNAPSHOT</craftbukkit.version>
|
<craftbukkit.version>LATEST</craftbukkit.version>
|
||||||
<citizensapi.version>2.0.8-SNAPSHOT</citizensapi.version>
|
<citizensapi.version>2.0.9-SNAPSHOT</citizensapi.version>
|
||||||
<vault.version>1.2.19-SNAPSHOT</vault.version>
|
<vault.version>1.2.19-SNAPSHOT</vault.version>
|
||||||
<powermock.version>1.4.12</powermock.version>
|
<powermock.version>1.4.12</powermock.version>
|
||||||
<build.number>Unknown</build.number>
|
<build.number>Unknown</build.number>
|
||||||
@ -34,7 +34,21 @@
|
|||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
|
<pluginRepositories>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>bukkit-plugins</id>
|
||||||
|
<url>http://repo.bukkit.org/content/groups/public</url>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bukkit</groupId>
|
||||||
|
<artifactId>bukkit</artifactId>
|
||||||
|
<version>${craftbukkit.version}</version>
|
||||||
|
<type>jar</type>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>craftbukkit</artifactId>
|
<artifactId>craftbukkit</artifactId>
|
||||||
@ -97,7 +111,6 @@
|
|||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
@ -112,6 +125,12 @@
|
|||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
<version>2.3.2</version>
|
<version>2.3.2</version>
|
||||||
|
<configuration>
|
||||||
|
<excludes>
|
||||||
|
<exclude>net.minecraft.server.*</exclude>
|
||||||
|
<exclude>org.bukkit.craftbukkit.*</exclude>
|
||||||
|
</excludes>
|
||||||
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -431,5 +431,5 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String COMPATIBLE_MC_VERSION = "1.5.2";
|
private static final String COMPATIBLE_MC_VERSION = "1.6.1";
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2011 Tyler Blair. All rights reserved.
|
* Copyright 2011-2013 Tyler Blair. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification, are
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
* permitted provided that the following conditions are met:
|
* permitted provided that the following conditions are met:
|
||||||
@ -25,14 +25,14 @@
|
|||||||
* authors and contributors and should not be interpreted as representing official policies,
|
* authors and contributors and should not be interpreted as representing official policies,
|
||||||
* either expressed or implied, of anybody else.
|
* either expressed or implied, of anybody else.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.citizensnpcs;
|
package net.citizensnpcs;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.Proxy;
|
import java.net.Proxy;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
@ -45,6 +45,7 @@ import java.util.LinkedHashSet;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
import java.util.zip.GZIPOutputStream;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
@ -53,22 +54,7 @@ import org.bukkit.plugin.Plugin;
|
|||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* The metrics class obtains data about a plugin and submits statistics about it
|
|
||||||
* to the metrics backend.
|
|
||||||
* </p>
|
|
||||||
* <p>
|
|
||||||
* Public methods provided by this class:
|
|
||||||
* </p>
|
|
||||||
* <code>
|
|
||||||
* Graph createGraph(String name); <br/>
|
|
||||||
* void addCustomData(Metrics.Plotter plotter); <br/>
|
|
||||||
* void start(); <br/>
|
|
||||||
* </code>
|
|
||||||
*/
|
|
||||||
public class Metrics {
|
public class Metrics {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The plugin configuration file
|
* The plugin configuration file
|
||||||
*/
|
*/
|
||||||
@ -84,12 +70,6 @@ public class Metrics {
|
|||||||
*/
|
*/
|
||||||
private final boolean debug;
|
private final boolean debug;
|
||||||
|
|
||||||
/**
|
|
||||||
* The default graph, used for addCustomData when you don't want a specific
|
|
||||||
* graph
|
|
||||||
*/
|
|
||||||
private final Graph defaultGraph = new Graph("Default");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All of the custom graphs to submit to metrics
|
* All of the custom graphs to submit to metrics
|
||||||
*/
|
*/
|
||||||
@ -142,27 +122,15 @@ public class Metrics {
|
|||||||
debug = configuration.getBoolean("debug", false);
|
debug = configuration.getBoolean("debug", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void addCustomData(Plotter plotter) {
|
||||||
* Adds a custom data plotter to the default graph
|
Graph graph = new Graph(plotter.name);
|
||||||
*
|
graph.addPlotter(plotter);
|
||||||
* @param plotter
|
addGraph(graph);
|
||||||
* The plotter to use to plot custom data
|
|
||||||
*/
|
|
||||||
public void addCustomData(final Plotter plotter) {
|
|
||||||
if (plotter == null) {
|
|
||||||
throw new IllegalArgumentException("Plotter cannot be null");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the plotter to the graph o/
|
|
||||||
defaultGraph.addPlotter(plotter);
|
|
||||||
|
|
||||||
// Ensure the default graph is included in the submitted graphs
|
|
||||||
graphs.add(defaultGraph);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a Graph object to Metrics that represents data for the plugin that
|
* Add a Graph object to BukkitMetrics that represents data for the plugin
|
||||||
* should be sent to the backend
|
* that should be sent to the backend
|
||||||
*
|
*
|
||||||
* @param graph
|
* @param graph
|
||||||
* The name of the graph
|
* The name of the graph
|
||||||
@ -204,7 +172,7 @@ public class Metrics {
|
|||||||
* Disables metrics for the server by setting "opt-out" to true in the
|
* Disables metrics for the server by setting "opt-out" to true in the
|
||||||
* config file and canceling the metrics task.
|
* config file and canceling the metrics task.
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
*/
|
*/
|
||||||
public void disable() throws IOException {
|
public void disable() throws IOException {
|
||||||
// This has to be synchronized or it can collide with the check in the
|
// This has to be synchronized or it can collide with the check in the
|
||||||
@ -229,7 +197,7 @@ public class Metrics {
|
|||||||
* Enables metrics for the server by setting "opt-out" to false in the
|
* Enables metrics for the server by setting "opt-out" to false in the
|
||||||
* config file and starting the metrics task.
|
* config file and starting the metrics task.
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
*/
|
*/
|
||||||
public void enable() throws IOException {
|
public void enable() throws IOException {
|
||||||
// This has to be synchronized or it can collide with the check in the
|
// This has to be synchronized or it can collide with the check in the
|
||||||
@ -326,15 +294,15 @@ public class Metrics {
|
|||||||
// any code outside of this class / Java
|
// any code outside of this class / Java
|
||||||
|
|
||||||
// Construct the post data
|
// Construct the post data
|
||||||
final StringBuilder data = new StringBuilder();
|
StringBuilder json = new StringBuilder(1024);
|
||||||
|
json.append('{');
|
||||||
|
|
||||||
// The plugin's description file containg all of the plugin data such as
|
// The plugin's description file containg all of the plugin data such as
|
||||||
// name, version, author, etc
|
// name, version, author, etc
|
||||||
data.append(encode("guid")).append('=').append(encode(guid));
|
appendJSONPair(json, "guid", guid);
|
||||||
encodeDataPair(data, "version", pluginVersion);
|
appendJSONPair(json, "plugin_version", pluginVersion);
|
||||||
encodeDataPair(data, "server", serverVersion);
|
appendJSONPair(json, "server_version", serverVersion);
|
||||||
encodeDataPair(data, "players", Integer.toString(playersOnline));
|
appendJSONPair(json, "players_online", Integer.toString(playersOnline));
|
||||||
encodeDataPair(data, "revision", String.valueOf(REVISION));
|
|
||||||
|
|
||||||
// New data as of R6
|
// New data as of R6
|
||||||
String osname = System.getProperty("os.name");
|
String osname = System.getProperty("os.name");
|
||||||
@ -348,49 +316,63 @@ public class Metrics {
|
|||||||
osarch = "x86_64";
|
osarch = "x86_64";
|
||||||
}
|
}
|
||||||
|
|
||||||
encodeDataPair(data, "osname", osname);
|
appendJSONPair(json, "osname", osname);
|
||||||
encodeDataPair(data, "osarch", osarch);
|
appendJSONPair(json, "osarch", osarch);
|
||||||
encodeDataPair(data, "osversion", osversion);
|
appendJSONPair(json, "osversion", osversion);
|
||||||
encodeDataPair(data, "cores", Integer.toString(coreCount));
|
appendJSONPair(json, "cores", Integer.toString(coreCount));
|
||||||
encodeDataPair(data, "online-mode", Boolean.toString(onlineMode));
|
appendJSONPair(json, "auth_mode", onlineMode ? "1" : "0");
|
||||||
encodeDataPair(data, "java_version", java_version);
|
appendJSONPair(json, "java_version", java_version);
|
||||||
|
|
||||||
// If we're pinging, append it
|
// If we're pinging, append it
|
||||||
if (isPing) {
|
if (isPing) {
|
||||||
encodeDataPair(data, "ping", "true");
|
appendJSONPair(json, "ping", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Acquire a lock on the graphs, which lets us make the assumption we
|
if (graphs.size() > 0) {
|
||||||
// also lock everything
|
synchronized (graphs) {
|
||||||
// inside of the graph (e.g plotters)
|
json.append(',');
|
||||||
synchronized (graphs) {
|
json.append('"');
|
||||||
final Iterator<Graph> iter = graphs.iterator();
|
json.append("graphs");
|
||||||
|
json.append('"');
|
||||||
|
json.append(':');
|
||||||
|
json.append('{');
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
boolean firstGraph = true;
|
||||||
final Graph graph = iter.next();
|
|
||||||
|
|
||||||
for (Plotter plotter : graph.getPlotters()) {
|
final Iterator<Graph> iter = graphs.iterator();
|
||||||
// The key name to send to the metrics server
|
|
||||||
// The format is C-GRAPHNAME-PLOTTERNAME where separator -
|
|
||||||
// is defined at the top
|
|
||||||
// Legacy (R4) submitters use the format Custom%s, or
|
|
||||||
// CustomPLOTTERNAME
|
|
||||||
final String key = String.format("C%s%s%s%s", CUSTOM_DATA_SEPARATOR, graph.getName(),
|
|
||||||
CUSTOM_DATA_SEPARATOR, plotter.getColumnName());
|
|
||||||
|
|
||||||
// The value to send, which for the foreseeable future is
|
while (iter.hasNext()) {
|
||||||
// just the string
|
Graph graph = iter.next();
|
||||||
// value of plotter.getValue()
|
|
||||||
final String value = Integer.toString(plotter.getValue());
|
|
||||||
|
|
||||||
// Add it to the http post data :)
|
StringBuilder graphJson = new StringBuilder();
|
||||||
encodeDataPair(data, key, value);
|
graphJson.append('{');
|
||||||
|
|
||||||
|
for (Plotter plotter : graph.getPlotters()) {
|
||||||
|
appendJSONPair(graphJson, plotter.getColumnName(), Integer.toString(plotter.getValue()));
|
||||||
|
}
|
||||||
|
|
||||||
|
graphJson.append('}');
|
||||||
|
|
||||||
|
if (!firstGraph) {
|
||||||
|
json.append(',');
|
||||||
|
}
|
||||||
|
|
||||||
|
json.append(escapeJSON(graph.getName()));
|
||||||
|
json.append(':');
|
||||||
|
json.append(graphJson);
|
||||||
|
|
||||||
|
firstGraph = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
json.append('}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// close json
|
||||||
|
json.append('}');
|
||||||
|
|
||||||
// Create the url
|
// Create the url
|
||||||
URL url = new URL(BASE_URL + String.format(REPORT_URL, encode(pluginName)));
|
URL url = new URL(BASE_URL + String.format(REPORT_URL, urlEncode(pluginName)));
|
||||||
|
|
||||||
// Connect to the website
|
// Connect to the website
|
||||||
URLConnection connection;
|
URLConnection connection;
|
||||||
@ -403,26 +385,48 @@ public class Metrics {
|
|||||||
connection = url.openConnection();
|
connection = url.openConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
byte[] uncompressed = json.toString().getBytes();
|
||||||
|
byte[] compressed = gzip(json.toString());
|
||||||
|
|
||||||
|
// Headers
|
||||||
|
connection.addRequestProperty("User-Agent", "MCStats/" + REVISION);
|
||||||
|
connection.addRequestProperty("Content-Type", "application/json");
|
||||||
|
connection.addRequestProperty("Content-Encoding", "gzip");
|
||||||
|
connection.addRequestProperty("Content-Length", Integer.toString(compressed.length));
|
||||||
|
connection.addRequestProperty("Accept", "application/json");
|
||||||
|
connection.addRequestProperty("Connection", "close");
|
||||||
|
|
||||||
connection.setDoOutput(true);
|
connection.setDoOutput(true);
|
||||||
|
|
||||||
|
if (debug) {
|
||||||
|
System.out.println("[Metrics] Prepared request for " + pluginName + " uncompressed=" + uncompressed.length
|
||||||
|
+ " compressed=" + compressed.length);
|
||||||
|
}
|
||||||
|
|
||||||
// Write the data
|
// Write the data
|
||||||
final OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
|
OutputStream os = connection.getOutputStream();
|
||||||
writer.write(data.toString());
|
os.write(compressed);
|
||||||
writer.flush();
|
os.flush();
|
||||||
|
|
||||||
// Now read the response
|
// Now read the response
|
||||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||||
final String response = reader.readLine();
|
String response = reader.readLine();
|
||||||
|
|
||||||
// close resources
|
// close resources
|
||||||
writer.close();
|
os.close();
|
||||||
reader.close();
|
reader.close();
|
||||||
|
|
||||||
if (response == null || response.startsWith("ERR")) {
|
if (response == null || response.startsWith("ERR") || response.startsWith("7")) {
|
||||||
throw new IOException(response); // Throw the exception
|
if (response == null) {
|
||||||
|
response = "null";
|
||||||
|
} else if (response.startsWith("7")) {
|
||||||
|
response = response.substring(response.startsWith("7,") ? 2 : 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new IOException(response);
|
||||||
} else {
|
} else {
|
||||||
// Is this the first update this hour?
|
// Is this the first update this hour?
|
||||||
if (response.contains("OK This is your first update this hour")) {
|
if (response.equals("1") || response.contains("This is your first update this hour")) {
|
||||||
synchronized (graphs) {
|
synchronized (graphs) {
|
||||||
final Iterator<Graph> iter = graphs.iterator();
|
final Iterator<Graph> iter = graphs.iterator();
|
||||||
|
|
||||||
@ -556,7 +560,7 @@ public class Metrics {
|
|||||||
/**
|
/**
|
||||||
* Gets an <b>unmodifiable</b> set of the plotter objects in the graph
|
* Gets an <b>unmodifiable</b> set of the plotter objects in the graph
|
||||||
*
|
*
|
||||||
* @return an unmodifiable {@link Set} of the plotter objects
|
* @return an unmodifiable {@link java.util.Set} of the plotter objects
|
||||||
*/
|
*/
|
||||||
public Set<Plotter> getPlotters() {
|
public Set<Plotter> getPlotters() {
|
||||||
return Collections.unmodifiableSet(plotters);
|
return Collections.unmodifiableSet(plotters);
|
||||||
@ -568,8 +572,8 @@ public class Metrics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the server owner decides to opt-out of Metrics while the
|
* Called when the server owner decides to opt-out of BukkitMetrics
|
||||||
* server is running.
|
* while the server is running.
|
||||||
*/
|
*/
|
||||||
protected void onOptOut() {
|
protected void onOptOut() {
|
||||||
}
|
}
|
||||||
@ -583,7 +587,6 @@ public class Metrics {
|
|||||||
public void removePlotter(final Plotter plotter) {
|
public void removePlotter(final Plotter plotter) {
|
||||||
plotters.remove(plotter);
|
plotters.remove(plotter);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -654,34 +657,114 @@ public class Metrics {
|
|||||||
*/
|
*/
|
||||||
public void reset() {
|
public void reset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base url of the metrics domain
|
* Appends a json encoded key/value pair to the given string builder.
|
||||||
|
*
|
||||||
|
* @param json
|
||||||
|
* @param key
|
||||||
|
* @param value
|
||||||
|
* @throws UnsupportedEncodingException
|
||||||
*/
|
*/
|
||||||
private static final String BASE_URL = "http://mcstats.org";
|
private static void appendJSONPair(StringBuilder json, String key, String value)
|
||||||
|
throws UnsupportedEncodingException {
|
||||||
|
boolean isValueNumeric = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (value.equals("0") || !value.endsWith("0")) {
|
||||||
|
Double.parseDouble(value);
|
||||||
|
isValueNumeric = true;
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
isValueNumeric = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (json.charAt(json.length() - 1) != '{') {
|
||||||
|
json.append(',');
|
||||||
|
}
|
||||||
|
|
||||||
|
json.append(escapeJSON(key));
|
||||||
|
json.append(':');
|
||||||
|
|
||||||
|
if (isValueNumeric) {
|
||||||
|
json.append(value);
|
||||||
|
} else {
|
||||||
|
json.append(escapeJSON(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The separator to use for custom data. This MUST NOT change unless you are
|
* Escape a string to create a valid JSON string
|
||||||
* hosting your own version of metrics and want to change it.
|
*
|
||||||
|
* @param text
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
private static final String CUSTOM_DATA_SEPARATOR = "~~";
|
private static String escapeJSON(String text) {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
|
builder.append('"');
|
||||||
|
for (int index = 0; index < text.length(); index++) {
|
||||||
|
char chr = text.charAt(index);
|
||||||
|
|
||||||
|
switch (chr) {
|
||||||
|
case '"':
|
||||||
|
case '\\':
|
||||||
|
builder.append('\\');
|
||||||
|
builder.append(chr);
|
||||||
|
break;
|
||||||
|
case '\b':
|
||||||
|
builder.append("\\b");
|
||||||
|
break;
|
||||||
|
case '\t':
|
||||||
|
builder.append("\\t");
|
||||||
|
break;
|
||||||
|
case '\n':
|
||||||
|
builder.append("\\n");
|
||||||
|
break;
|
||||||
|
case '\r':
|
||||||
|
builder.append("\\r");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (chr < ' ') {
|
||||||
|
String t = "000" + Integer.toHexString(chr);
|
||||||
|
builder.append("\\u" + t.substring(t.length() - 4));
|
||||||
|
} else {
|
||||||
|
builder.append(chr);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
builder.append('"');
|
||||||
|
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interval of time to ping (in minutes)
|
* GZip compress a string of bytes
|
||||||
|
*
|
||||||
|
* @param input
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
private static final int PING_INTERVAL = 10;
|
public static byte[] gzip(String input) {
|
||||||
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
|
GZIPOutputStream gzos = null;
|
||||||
|
|
||||||
/**
|
try {
|
||||||
* The url used to report a server's status
|
gzos = new GZIPOutputStream(baos);
|
||||||
*/
|
gzos.write(input.getBytes("UTF-8"));
|
||||||
private static final String REPORT_URL = "/report/%s";
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if (gzos != null)
|
||||||
|
try {
|
||||||
|
gzos.close();
|
||||||
|
} catch (IOException ignore) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
return baos.toByteArray();
|
||||||
* The current revision number
|
}
|
||||||
*/
|
|
||||||
private final static int REVISION = 6;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encode text as UTF-8
|
* Encode text as UTF-8
|
||||||
@ -690,31 +773,27 @@ public class Metrics {
|
|||||||
* the text to encode
|
* the text to encode
|
||||||
* @return the encoded text, as UTF-8
|
* @return the encoded text, as UTF-8
|
||||||
*/
|
*/
|
||||||
private static String encode(final String text) throws UnsupportedEncodingException {
|
private static String urlEncode(final String text) throws UnsupportedEncodingException {
|
||||||
return URLEncoder.encode(text, "UTF-8");
|
return URLEncoder.encode(text, "UTF-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* The base url of the metrics domain
|
||||||
* Encode a key/value data pair to be used in a HTTP post request. This
|
|
||||||
* INCLUDES a & so the first key/value pair MUST be included manually, e.g:
|
|
||||||
* </p>
|
|
||||||
* <code>
|
|
||||||
* StringBuffer data = new StringBuffer();
|
|
||||||
* data.append(encode("guid")).append('=').append(encode(guid));
|
|
||||||
* encodeDataPair(data, "version", description.getVersion());
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @param buffer
|
|
||||||
* the stringbuilder to append the data pair onto
|
|
||||||
* @param key
|
|
||||||
* the key value
|
|
||||||
* @param value
|
|
||||||
* the value
|
|
||||||
*/
|
*/
|
||||||
private static void encodeDataPair(final StringBuilder buffer, final String key, final String value)
|
private static final String BASE_URL = "http://report.mcstats.org";
|
||||||
throws UnsupportedEncodingException {
|
|
||||||
buffer.append('&').append(encode(key)).append('=').append(encode(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interval of time to ping (in minutes)
|
||||||
|
*/
|
||||||
|
private static final int PING_INTERVAL = 15;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The url used to report a server's status
|
||||||
|
*/
|
||||||
|
private static final String REPORT_URL = "/plugin/%s";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current revision number
|
||||||
|
*/
|
||||||
|
private final static int REVISION = 7;
|
||||||
}
|
}
|
@ -22,11 +22,11 @@ import net.citizensnpcs.trait.CurrentLocation;
|
|||||||
import net.citizensnpcs.util.Messages;
|
import net.citizensnpcs.util.Messages;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityLiving;
|
import net.minecraft.server.v1_6_R1.EntityLiving;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftLivingEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftLivingEntity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||||
|
@ -12,6 +12,7 @@ import net.citizensnpcs.npc.entity.EnderDragonController;
|
|||||||
import net.citizensnpcs.npc.entity.EndermanController;
|
import net.citizensnpcs.npc.entity.EndermanController;
|
||||||
import net.citizensnpcs.npc.entity.GhastController;
|
import net.citizensnpcs.npc.entity.GhastController;
|
||||||
import net.citizensnpcs.npc.entity.GiantController;
|
import net.citizensnpcs.npc.entity.GiantController;
|
||||||
|
import net.citizensnpcs.npc.entity.HorseController;
|
||||||
import net.citizensnpcs.npc.entity.HumanController;
|
import net.citizensnpcs.npc.entity.HumanController;
|
||||||
import net.citizensnpcs.npc.entity.IronGolemController;
|
import net.citizensnpcs.npc.entity.IronGolemController;
|
||||||
import net.citizensnpcs.npc.entity.MagmaCubeController;
|
import net.citizensnpcs.npc.entity.MagmaCubeController;
|
||||||
@ -38,8 +39,6 @@ import com.google.common.base.Throwables;
|
|||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
public class EntityControllers {
|
public class EntityControllers {
|
||||||
private static final Map<EntityType, Class<? extends EntityController>> TYPES = Maps.newEnumMap(EntityType.class);
|
|
||||||
|
|
||||||
public static EntityController createForType(EntityType type) {
|
public static EntityController createForType(EntityType type) {
|
||||||
Class<? extends EntityController> controllerClass = TYPES.get(type);
|
Class<? extends EntityController> controllerClass = TYPES.get(type);
|
||||||
if (controllerClass == null)
|
if (controllerClass == null)
|
||||||
@ -56,6 +55,8 @@ public class EntityControllers {
|
|||||||
TYPES.put(type, controller);
|
TYPES.put(type, controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final Map<EntityType, Class<? extends EntityController>> TYPES = Maps.newEnumMap(EntityType.class);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
TYPES.put(EntityType.BAT, BatController.class);
|
TYPES.put(EntityType.BAT, BatController.class);
|
||||||
TYPES.put(EntityType.BLAZE, BlazeController.class);
|
TYPES.put(EntityType.BLAZE, BlazeController.class);
|
||||||
@ -67,6 +68,7 @@ public class EntityControllers {
|
|||||||
TYPES.put(EntityType.ENDERMAN, EndermanController.class);
|
TYPES.put(EntityType.ENDERMAN, EndermanController.class);
|
||||||
TYPES.put(EntityType.GHAST, GhastController.class);
|
TYPES.put(EntityType.GHAST, GhastController.class);
|
||||||
TYPES.put(EntityType.GIANT, GiantController.class);
|
TYPES.put(EntityType.GIANT, GiantController.class);
|
||||||
|
TYPES.put(EntityType.HORSE, HorseController.class);
|
||||||
TYPES.put(EntityType.IRON_GOLEM, IronGolemController.class);
|
TYPES.put(EntityType.IRON_GOLEM, IronGolemController.class);
|
||||||
TYPES.put(EntityType.MAGMA_CUBE, MagmaCubeController.class);
|
TYPES.put(EntityType.MAGMA_CUBE, MagmaCubeController.class);
|
||||||
TYPES.put(EntityType.MUSHROOM_COW, MushroomCowController.class);
|
TYPES.put(EntityType.MUSHROOM_COW, MushroomCowController.class);
|
||||||
|
@ -5,12 +5,12 @@ import java.util.Map;
|
|||||||
|
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.minecraft.server.v1_5_R3.EntityLiving;
|
import net.minecraft.server.v1_6_R1.EntityLiving;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftWorld;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftWorld;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
@ -10,12 +10,9 @@ import net.citizensnpcs.api.astar.pathfinder.VectorGoal;
|
|||||||
import net.citizensnpcs.api.astar.pathfinder.VectorNode;
|
import net.citizensnpcs.api.astar.pathfinder.VectorNode;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.minecraft.server.v1_5_R3.EntityLiving;
|
import net.minecraft.server.v1_6_R1.EntityLiving;
|
||||||
|
|
||||||
import org.bukkit.Effect;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class AStarNavigationStrategy extends AbstractPathStrategy {
|
public class AStarNavigationStrategy extends AbstractPathStrategy {
|
||||||
@ -62,8 +59,6 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
vector = plan.getCurrentVector();
|
vector = plan.getCurrentVector();
|
||||||
World world = npc.getBukkitEntity().getWorld();
|
|
||||||
world.playEffect(vector.toLocation(world), Effect.STEP_SOUND, Material.STONE.getId());
|
|
||||||
}
|
}
|
||||||
EntityLiving handle = NMS.getHandle(npc.getBukkitEntity());
|
EntityLiving handle = NMS.getHandle(npc.getBukkitEntity());
|
||||||
double dX = vector.getBlockX() - handle.locX;
|
double dX = vector.getBlockX() - handle.locX;
|
||||||
|
@ -3,17 +3,17 @@ package net.citizensnpcs.npc.ai;
|
|||||||
import net.citizensnpcs.api.ai.tree.BehaviorGoalAdapter;
|
import net.citizensnpcs.api.ai.tree.BehaviorGoalAdapter;
|
||||||
import net.citizensnpcs.api.ai.tree.BehaviorStatus;
|
import net.citizensnpcs.api.ai.tree.BehaviorStatus;
|
||||||
import net.citizensnpcs.util.PlayerAnimation;
|
import net.citizensnpcs.util.PlayerAnimation;
|
||||||
import net.minecraft.server.v1_5_R3.Block;
|
import net.minecraft.server.v1_6_R1.Block;
|
||||||
import net.minecraft.server.v1_5_R3.Enchantment;
|
import net.minecraft.server.v1_6_R1.Enchantment;
|
||||||
import net.minecraft.server.v1_5_R3.EnchantmentManager;
|
import net.minecraft.server.v1_6_R1.EnchantmentManager;
|
||||||
import net.minecraft.server.v1_5_R3.EntityLiving;
|
import net.minecraft.server.v1_6_R1.EntityLiving;
|
||||||
import net.minecraft.server.v1_5_R3.EntityPlayer;
|
import net.minecraft.server.v1_6_R1.EntityPlayer;
|
||||||
import net.minecraft.server.v1_5_R3.ItemStack;
|
import net.minecraft.server.v1_6_R1.ItemStack;
|
||||||
import net.minecraft.server.v1_5_R3.Material;
|
import net.minecraft.server.v1_6_R1.Material;
|
||||||
import net.minecraft.server.v1_5_R3.MobEffectList;
|
import net.minecraft.server.v1_6_R1.MobEffectList;
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftLivingEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftLivingEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_6_R1.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ public class BlockBreaker extends BehaviorGoalAdapter {
|
|||||||
return Math.pow(entity.locX - x, 2) + Math.pow(entity.locY - y, 2) + Math.pow(entity.locZ - z, 2);
|
return Math.pow(entity.locX - x, 2) + Math.pow(entity.locY - y, 2) + Math.pow(entity.locZ - z, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
private net.minecraft.server.v1_5_R3.ItemStack getCurrentItem() {
|
private net.minecraft.server.v1_6_R1.ItemStack getCurrentItem() {
|
||||||
return configuration.item() != null ? CraftItemStack.asNMSCopy(configuration.item()) : entity.getEquipment(0);
|
return configuration.item() != null ? CraftItemStack.asNMSCopy(configuration.item()) : entity.getEquipment(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ public class CitizensNavigator implements Navigator, Runnable {
|
|||||||
}
|
}
|
||||||
localParams = defaultParams.clone();
|
localParams = defaultParams.clone();
|
||||||
PathStrategy newStrategy;
|
PathStrategy newStrategy;
|
||||||
if (Setting.USE_NEW_PATHFINDER.asBoolean()) {
|
if (Setting.USE_NEW_PATHFINDER.asBoolean() || NMS.isSentient(npc.getBukkitEntity())) {
|
||||||
newStrategy = new AStarNavigationStrategy(npc, target, localParams);
|
newStrategy = new AStarNavigationStrategy(npc, target, localParams);
|
||||||
} else
|
} else
|
||||||
newStrategy = new MCNavigationStrategy(npc, target, localParams);
|
newStrategy = new MCNavigationStrategy(npc, target, localParams);
|
||||||
|
@ -4,11 +4,11 @@ import net.citizensnpcs.api.ai.NavigatorParameters;
|
|||||||
import net.citizensnpcs.api.ai.TargetType;
|
import net.citizensnpcs.api.ai.TargetType;
|
||||||
import net.citizensnpcs.api.ai.event.CancelReason;
|
import net.citizensnpcs.api.ai.event.CancelReason;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.minecraft.server.v1_5_R3.EntityLiving;
|
import net.minecraft.server.v1_6_R1.EntityInsentient;
|
||||||
import net.minecraft.server.v1_5_R3.Navigation;
|
import net.minecraft.server.v1_6_R1.Navigation;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftLivingEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftLivingEntity;
|
||||||
|
|
||||||
public class MCNavigationStrategy extends AbstractPathStrategy {
|
public class MCNavigationStrategy extends AbstractPathStrategy {
|
||||||
private final Navigation navigation;
|
private final Navigation navigation;
|
||||||
@ -19,7 +19,7 @@ public class MCNavigationStrategy extends AbstractPathStrategy {
|
|||||||
super(TargetType.LOCATION);
|
super(TargetType.LOCATION);
|
||||||
this.target = dest;
|
this.target = dest;
|
||||||
this.parameters = params;
|
this.parameters = params;
|
||||||
EntityLiving handle = ((CraftLivingEntity) npc.getBukkitEntity()).getHandle();
|
EntityInsentient handle = (EntityInsentient) ((CraftLivingEntity) npc.getBukkitEntity()).getHandle();
|
||||||
handle.onGround = true;
|
handle.onGround = true;
|
||||||
// not sure of a better way around this - if onGround is false, then
|
// not sure of a better way around this - if onGround is false, then
|
||||||
// navigation won't execute, and calling entity.move doesn't
|
// navigation won't execute, and calling entity.move doesn't
|
||||||
@ -27,7 +27,7 @@ public class MCNavigationStrategy extends AbstractPathStrategy {
|
|||||||
navigation = handle.getNavigation();
|
navigation = handle.getNavigation();
|
||||||
navigation.a(parameters.avoidWater());
|
navigation.a(parameters.avoidWater());
|
||||||
navigation.a(dest.getX(), dest.getY(), dest.getZ(), parameters.speed());
|
navigation.a(dest.getX(), dest.getY(), dest.getZ(), parameters.speed());
|
||||||
if (navigation.f())
|
if (navigation.g())
|
||||||
setCancelReason(CancelReason.STUCK);
|
setCancelReason(CancelReason.STUCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,6 +57,6 @@ public class MCNavigationStrategy extends AbstractPathStrategy {
|
|||||||
return true;
|
return true;
|
||||||
navigation.a(parameters.avoidWater());
|
navigation.a(parameters.avoidWater());
|
||||||
navigation.a(parameters.speed());
|
navigation.a(parameters.speed());
|
||||||
return navigation.f();
|
return navigation.g();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,15 +11,16 @@ import net.citizensnpcs.api.ai.event.CancelReason;
|
|||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.PlayerAnimation;
|
import net.citizensnpcs.util.PlayerAnimation;
|
||||||
import net.minecraft.server.v1_5_R3.Entity;
|
import net.minecraft.server.v1_6_R1.Entity;
|
||||||
import net.minecraft.server.v1_5_R3.EntityLiving;
|
import net.minecraft.server.v1_6_R1.EntityInsentient;
|
||||||
import net.minecraft.server.v1_5_R3.EntityPlayer;
|
import net.minecraft.server.v1_6_R1.EntityLiving;
|
||||||
import net.minecraft.server.v1_5_R3.Navigation;
|
import net.minecraft.server.v1_6_R1.EntityPlayer;
|
||||||
import net.minecraft.server.v1_5_R3.PathEntity;
|
import net.minecraft.server.v1_6_R1.Navigation;
|
||||||
|
import net.minecraft.server.v1_6_R1.PathEntity;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftLivingEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftLivingEntity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
|
||||||
public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
||||||
@ -27,18 +28,19 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
|||||||
private int attackTicks;
|
private int attackTicks;
|
||||||
private CancelReason cancelReason;
|
private CancelReason cancelReason;
|
||||||
private final EntityLiving handle;
|
private final EntityLiving handle;
|
||||||
private final Navigation navigation;
|
private final NPC npc;
|
||||||
private final NavigatorParameters parameters;
|
private final NavigatorParameters parameters;
|
||||||
|
private final TargetNavigator targetNavigator;
|
||||||
private final Entity target;
|
private final Entity target;
|
||||||
private final NavigationFieldWrapper wrapper;
|
|
||||||
|
|
||||||
public MCTargetStrategy(NPC handle, org.bukkit.entity.Entity target, boolean aggro, NavigatorParameters params) {
|
public MCTargetStrategy(NPC npc, org.bukkit.entity.Entity target, boolean aggro, NavigatorParameters params) {
|
||||||
this.handle = ((CraftLivingEntity) handle.getBukkitEntity()).getHandle();
|
this.npc = npc;
|
||||||
|
this.handle = ((CraftLivingEntity) npc.getBukkitEntity()).getHandle();
|
||||||
this.target = ((CraftEntity) target).getHandle();
|
this.target = ((CraftEntity) target).getHandle();
|
||||||
this.navigation = this.handle.getNavigation();
|
this.targetNavigator = this.handle instanceof EntityInsentient ? new NavigationFieldWrapper(
|
||||||
|
((EntityInsentient) this.handle).getNavigation()) : new AStarTargeter();
|
||||||
this.aggro = aggro;
|
this.aggro = aggro;
|
||||||
this.parameters = params;
|
this.parameters = params;
|
||||||
this.wrapper = new NavigationFieldWrapper(this.navigation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canAttack() {
|
private boolean canAttack() {
|
||||||
@ -87,12 +89,12 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setPath() {
|
private void setPath() {
|
||||||
navigation.a(wrapper.findPath(handle, target), parameters.speed());
|
targetNavigator.setPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stop() {
|
public void stop() {
|
||||||
navigation.g();
|
targetNavigator.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -112,7 +114,6 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
|||||||
}
|
}
|
||||||
if (cancelReason != null)
|
if (cancelReason != null)
|
||||||
return true;
|
return true;
|
||||||
navigation.a(parameters.avoidWater());
|
|
||||||
setPath();
|
setPath();
|
||||||
NMS.look(handle, target);
|
NMS.look(handle, target);
|
||||||
if (aggro && canAttack()) {
|
if (aggro && canAttack()) {
|
||||||
@ -133,11 +134,31 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class NavigationFieldWrapper {
|
private class AStarTargeter implements TargetNavigator {
|
||||||
|
private AStarNavigationStrategy strategy = new AStarNavigationStrategy(npc, target.getBukkitEntity()
|
||||||
|
.getLocation(TARGET_LOCATION), parameters);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPath() {
|
||||||
|
strategy = new AStarNavigationStrategy(npc, target.getBukkitEntity().getLocation(TARGET_LOCATION),
|
||||||
|
parameters);
|
||||||
|
strategy.update();
|
||||||
|
cancelReason = strategy.getCancelReason();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop() {
|
||||||
|
strategy.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class NavigationFieldWrapper implements TargetNavigator {
|
||||||
float e;
|
float e;
|
||||||
boolean j = true, k, l, m;
|
boolean j = true, k, l, m;
|
||||||
|
private final Navigation navigation;
|
||||||
|
|
||||||
private NavigationFieldWrapper(Navigation navigation) {
|
private NavigationFieldWrapper(Navigation navigation) {
|
||||||
|
this.navigation = navigation;
|
||||||
this.k = navigation.c();
|
this.k = navigation.c();
|
||||||
this.l = navigation.a();
|
this.l = navigation.a();
|
||||||
try {
|
try {
|
||||||
@ -155,12 +176,28 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
|||||||
public PathEntity findPath(Entity from, Entity to) {
|
public PathEntity findPath(Entity from, Entity to) {
|
||||||
return handle.world.findPath(from, to, e, j, k, l, m);
|
return handle.world.findPath(from, to, e, j, k, l, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPath() {
|
||||||
|
navigation.a(parameters.avoidWater());
|
||||||
|
navigation.a(findPath(handle, target), parameters.speed());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop() {
|
||||||
|
navigation.g();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static interface TargetNavigator {
|
||||||
|
void setPath();
|
||||||
|
|
||||||
|
void stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int ATTACK_DELAY_TICKS = 20;
|
private static final int ATTACK_DELAY_TICKS = 20;
|
||||||
private static final Location HANDLE_LOCATION = new Location(null, 0, 0, 0);
|
private static final Location HANDLE_LOCATION = new Location(null, 0, 0, 0);
|
||||||
private static Field NAV_E, NAV_J, NAV_M;
|
private static Field NAV_E, NAV_J, NAV_M;
|
||||||
|
|
||||||
private static final Location TARGET_LOCATION = new Location(null, 0, 0, 0);
|
private static final Location TARGET_LOCATION = new Location(null, 0, 0, 0);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityBat;
|
import net.minecraft.server.v1_6_R1.EntityBat;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftBat;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftBat;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.entity.Bat;
|
import org.bukkit.entity.Bat;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -58,22 +58,22 @@ public class BatController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float bE() {
|
public void be() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void bo() {
|
|
||||||
if (npc == null)
|
if (npc == null)
|
||||||
super.bo();
|
super.be();
|
||||||
else {
|
else {
|
||||||
NMS.updateAI(this);
|
NMS.updateAI(this);
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* @Override
|
||||||
|
public float bE() {
|
||||||
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityBlaze;
|
import net.minecraft.server.v1_6_R1.EntityBlaze;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftBlaze;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftBlaze;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.entity.Blaze;
|
import org.bukkit.entity.Blaze;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -56,23 +56,23 @@ public class BlazeController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bq() {
|
public void bh() {
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
NMS.updateAI(this);
|
NMS.updateAI(this);
|
||||||
npc.update();
|
npc.update();
|
||||||
} else {
|
} else {
|
||||||
super.bq();
|
super.bh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityCaveSpider;
|
import net.minecraft.server.v1_6_R1.EntityCaveSpider;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftCaveSpider;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftCaveSpider;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.entity.CaveSpider;
|
import org.bukkit.entity.CaveSpider;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -58,21 +58,21 @@ public class CaveSpiderController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float bE() {
|
public void be() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
super.be();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void bo() {
|
|
||||||
super.bo();
|
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* @Override
|
||||||
|
public float bE() {
|
||||||
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bq() {
|
public void bh() {
|
||||||
if (npc == null)
|
if (npc == null)
|
||||||
super.bq();
|
super.bh();
|
||||||
else {
|
else {
|
||||||
NMS.updateAI(this);
|
NMS.updateAI(this);
|
||||||
npc.update();
|
npc.update();
|
||||||
@ -80,7 +80,7 @@ public class CaveSpiderController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityChicken;
|
import net.minecraft.server.v1_6_R1.EntityChicken;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftChicken;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftChicken;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.entity.Chicken;
|
import org.bukkit.entity.Chicken;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -53,24 +53,23 @@ public class ChickenController extends MobEntityController {
|
|||||||
this.npc = (CitizensNPC) npc;
|
this.npc = (CitizensNPC) npc;
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
NMS.clearGoals(goalSelector, targetSelector);
|
NMS.clearGoals(goalSelector, targetSelector);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bo() {
|
public void be() {
|
||||||
super.bo();
|
super.be();
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityCow;
|
import net.minecraft.server.v1_6_R1.EntityCow;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftCow;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftCow;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.entity.Cow;
|
import org.bukkit.entity.Cow;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -57,20 +57,21 @@ public class CowController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bo() {
|
public void be() {
|
||||||
super.bo();
|
super.be();
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,14 +7,14 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityCreeper;
|
import net.minecraft.server.v1_6_R1.EntityCreeper;
|
||||||
import net.minecraft.server.v1_5_R3.EntityLightning;
|
import net.minecraft.server.v1_6_R1.EntityLightning;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftCreeper;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftCreeper;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.entity.Creeper;
|
import org.bukkit.entity.Creeper;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -64,20 +64,20 @@ public class CreeperController extends MobEntityController {
|
|||||||
super.a(entitylightning);
|
super.a(entitylightning);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bo() {
|
public void be() {
|
||||||
super.bo();
|
super.be();
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityEnderDragon;
|
import net.minecraft.server.v1_6_R1.EntityEnderDragon;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEnderDragon;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEnderDragon;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.entity.EnderDragon;
|
import org.bukkit.entity.EnderDragon;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -56,15 +56,16 @@ public class EnderDragonController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bq() {
|
public void bh() {
|
||||||
if (npc == null)
|
if (npc == null) {
|
||||||
super.bq();
|
super.bh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -83,7 +84,7 @@ public class EnderDragonController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityEnderman;
|
import net.minecraft.server.v1_6_R1.EntityEnderman;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEnderman;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEnderman;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.entity.Enderman;
|
import org.bukkit.entity.Enderman;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -56,22 +56,22 @@ public class EndermanController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bo() {
|
public void be() {
|
||||||
super.bo();
|
super.be();
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bq() {
|
public void bh() {
|
||||||
if (npc == null)
|
if (npc == null)
|
||||||
super.bq();
|
super.bh();
|
||||||
else {
|
else {
|
||||||
NMS.updateAI(this);
|
NMS.updateAI(this);
|
||||||
npc.update();
|
npc.update();
|
||||||
@ -89,7 +89,7 @@ public class EndermanController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -13,29 +13,36 @@ import net.citizensnpcs.npc.network.EmptyNetworkManager;
|
|||||||
import net.citizensnpcs.npc.network.EmptySocket;
|
import net.citizensnpcs.npc.network.EmptySocket;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.Connection;
|
import net.citizensnpcs.util.nms.PlayerControllerJump;
|
||||||
import net.minecraft.server.v1_5_R3.EntityPlayer;
|
import net.citizensnpcs.util.nms.PlayerControllerLook;
|
||||||
import net.minecraft.server.v1_5_R3.EnumGamemode;
|
import net.citizensnpcs.util.nms.PlayerControllerMove;
|
||||||
import net.minecraft.server.v1_5_R3.MathHelper;
|
import net.minecraft.server.v1_6_R1.Connection;
|
||||||
import net.minecraft.server.v1_5_R3.MinecraftServer;
|
import net.minecraft.server.v1_6_R1.Entity;
|
||||||
import net.minecraft.server.v1_5_R3.Navigation;
|
import net.minecraft.server.v1_6_R1.EntityPlayer;
|
||||||
import net.minecraft.server.v1_5_R3.NetworkManager;
|
import net.minecraft.server.v1_6_R1.EnumGamemode;
|
||||||
import net.minecraft.server.v1_5_R3.Packet;
|
import net.minecraft.server.v1_6_R1.MathHelper;
|
||||||
import net.minecraft.server.v1_5_R3.Packet35EntityHeadRotation;
|
import net.minecraft.server.v1_6_R1.MinecraftServer;
|
||||||
import net.minecraft.server.v1_5_R3.Packet5EntityEquipment;
|
import net.minecraft.server.v1_6_R1.NetworkManager;
|
||||||
import net.minecraft.server.v1_5_R3.PlayerInteractManager;
|
import net.minecraft.server.v1_6_R1.Packet;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.Packet35EntityHeadRotation;
|
||||||
|
import net.minecraft.server.v1_6_R1.Packet5EntityEquipment;
|
||||||
|
import net.minecraft.server.v1_6_R1.PlayerInteractManager;
|
||||||
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.metadata.MetadataValue;
|
import org.bukkit.metadata.MetadataValue;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||||
|
private PlayerControllerJump controllerJump;
|
||||||
|
private PlayerControllerLook controllerLook;
|
||||||
|
private PlayerControllerMove controllerMove;
|
||||||
private boolean gravity = true;
|
private boolean gravity = true;
|
||||||
|
private int jumpTicks = 0;
|
||||||
private final CitizensNPC npc;
|
private final CitizensNPC npc;
|
||||||
private final Location packetLocationCache = new Location(null, 0, 0, 0);
|
private final Location packetLocationCache = new Location(null, 0, 0, 0);
|
||||||
private int packetUpdateCount;
|
private int packetUpdateCount;
|
||||||
@ -50,13 +57,13 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
|||||||
initialise(minecraftServer);
|
initialise(minecraftServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
@ -93,6 +100,10 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
|||||||
return super.getBukkitEntity();
|
return super.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PlayerControllerJump getControllerJump() {
|
||||||
|
return controllerJump;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NPC getNPC() {
|
public NPC getNPC() {
|
||||||
return npc;
|
return npc;
|
||||||
@ -102,19 +113,18 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
|||||||
Socket socket = new EmptySocket();
|
Socket socket = new EmptySocket();
|
||||||
NetworkManager conn = null;
|
NetworkManager conn = null;
|
||||||
try {
|
try {
|
||||||
conn = new EmptyNetworkManager(server.getLogger(), socket, "npc mgr", new Connection() {
|
conn = new EmptyNetworkManager(minecraftServer.getLogger(), socket, "npc mgr", new Connection() {
|
||||||
@Override
|
@Override
|
||||||
public boolean a() {
|
public boolean a() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}, server.F().getPrivate());
|
}, minecraftServer.H().getPrivate());
|
||||||
playerConnection = new EmptyNetHandler(minecraftServer, conn, this);
|
playerConnection = new EmptyNetHandler(minecraftServer, conn, this);
|
||||||
conn.a(playerConnection);
|
conn.a(playerConnection);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// swallow
|
// swallow
|
||||||
}
|
}
|
||||||
|
|
||||||
getNavigation().e(true);
|
|
||||||
Y = 1F; // stepHeight - must not stay as the default 0 (breaks steps).
|
Y = 1F; // stepHeight - must not stay as the default 0 (breaks steps).
|
||||||
// Check the EntityPlayer constructor for the new name.
|
// Check the EntityPlayer constructor for the new name.
|
||||||
|
|
||||||
@ -123,6 +133,13 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
|||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
// swallow
|
// swallow
|
||||||
}
|
}
|
||||||
|
controllerJump = new PlayerControllerJump(this);
|
||||||
|
controllerLook = new PlayerControllerLook(this);
|
||||||
|
controllerMove = new PlayerControllerMove(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNavigating() {
|
||||||
|
return npc.getNavigator().isNavigating();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -139,16 +156,15 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
|||||||
// (onGround is normally updated by the client)
|
// (onGround is normally updated by the client)
|
||||||
}
|
}
|
||||||
if (!npc.data().get("removefromplayerlist", true)) {
|
if (!npc.data().get("removefromplayerlist", true)) {
|
||||||
g();
|
h();
|
||||||
}
|
}
|
||||||
if (Math.abs(motX) < EPSILON && Math.abs(motY) < EPSILON && Math.abs(motZ) < EPSILON)
|
if (Math.abs(motX) < EPSILON && Math.abs(motY) < EPSILON && Math.abs(motZ) < EPSILON)
|
||||||
motX = motY = motZ = 0;
|
motX = motY = motZ = 0;
|
||||||
|
|
||||||
NMS.updateSenses(this);
|
|
||||||
if (navigating) {
|
if (navigating) {
|
||||||
Navigation navigation = getNavigation();
|
// Navigation navigation = getNavigation();
|
||||||
if (!navigation.f())
|
// if (!navigation.g())
|
||||||
navigation.e();
|
// navigation.e();
|
||||||
moveOnCurrentHeading();
|
moveOnCurrentHeading();
|
||||||
} else if (motX != 0 || motZ != 0 || motY != 0) {
|
} else if (motX != 0 || motZ != 0 || motY != 0) {
|
||||||
e(0, 0); // is this necessary? it does controllable but sometimes
|
e(0, 0); // is this necessary? it does controllable but sometimes
|
||||||
@ -163,29 +179,44 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
|||||||
private void moveOnCurrentHeading() {
|
private void moveOnCurrentHeading() {
|
||||||
NMS.updateAI(this);
|
NMS.updateAI(this);
|
||||||
// taken from EntityLiving update method
|
// taken from EntityLiving update method
|
||||||
if (bG) {
|
if (bd) {
|
||||||
/* boolean inLiquid = G() || I();
|
/* boolean inLiquid = G() || I();
|
||||||
if (inLiquid) {
|
if (inLiquid) {
|
||||||
motY += 0.04;
|
motY += 0.04;
|
||||||
} else //(handled elsewhere)*/
|
} else //(handled elsewhere)*/
|
||||||
if (onGround && bX == 0) {
|
if (onGround && jumpTicks == 0) {
|
||||||
bl();
|
ba();
|
||||||
bX = 10;
|
jumpTicks = 10;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
bX = 0;
|
jumpTicks = 0;
|
||||||
|
|
||||||
bD *= 0.98F;
|
be *= 0.98F;
|
||||||
bE *= 0.98F;
|
bf *= 0.98F;
|
||||||
bF *= 0.9F;
|
bg *= 0.9F;
|
||||||
|
|
||||||
float prev = aO;
|
e(be, bf); // movement method
|
||||||
aO *= bE();
|
|
||||||
e(bD, bE); // movement method
|
|
||||||
aO = prev;
|
|
||||||
NMS.setHeadYaw(this, yaw);
|
NMS.setHeadYaw(this, yaw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMoveDestination(double x, double y, double z, float speed) {
|
||||||
|
controllerMove.a(x, y, z, speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShouldJump() {
|
||||||
|
controllerJump.a();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTargetLook(Entity target, float yawOffset, float renderOffset) {
|
||||||
|
controllerLook.a(target, yawOffset, renderOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateAI() {
|
||||||
|
controllerMove.c();
|
||||||
|
controllerLook.a();
|
||||||
|
controllerJump.b();
|
||||||
|
}
|
||||||
|
|
||||||
private void updatePackets(boolean navigating) {
|
private void updatePackets(boolean navigating) {
|
||||||
if (++packetUpdateCount >= 30) {
|
if (++packetUpdateCount >= 30) {
|
||||||
Location current = getBukkitEntity().getLocation(packetLocationCache);
|
Location current = getBukkitEntity().getLocation(packetLocationCache);
|
||||||
@ -203,16 +234,18 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class PlayerNPC extends CraftPlayer implements NPCHolder {
|
public static class PlayerNPC extends CraftPlayer implements NPCHolder {
|
||||||
|
private final CraftServer cserver;
|
||||||
private final CitizensNPC npc;
|
private final CitizensNPC npc;
|
||||||
|
|
||||||
private PlayerNPC(EntityHumanNPC entity) {
|
private PlayerNPC(EntityHumanNPC entity) {
|
||||||
super((CraftServer) Bukkit.getServer(), entity);
|
super((CraftServer) Bukkit.getServer(), entity);
|
||||||
this.npc = entity.npc;
|
this.npc = entity.npc;
|
||||||
|
this.cserver = (CraftServer) Bukkit.getServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MetadataValue> getMetadata(String metadataKey) {
|
public List<MetadataValue> getMetadata(String metadataKey) {
|
||||||
return server.getEntityMetadata().getMetadata(this, metadataKey);
|
return cserver.getEntityMetadata().getMetadata(this, metadataKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -222,12 +255,12 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasMetadata(String metadataKey) {
|
public boolean hasMetadata(String metadataKey) {
|
||||||
return server.getEntityMetadata().hasMetadata(this, metadataKey);
|
return cserver.getEntityMetadata().hasMetadata(this, metadataKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
|
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
|
||||||
server.getEntityMetadata().removeMetadata(this, metadataKey, owningPlugin);
|
cserver.getEntityMetadata().removeMetadata(this, metadataKey, owningPlugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGravityEnabled(boolean enabled) {
|
public void setGravityEnabled(boolean enabled) {
|
||||||
@ -236,11 +269,10 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
|
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
|
||||||
server.getEntityMetadata().setMetadata(this, metadataKey, newMetadataValue);
|
cserver.getEntityMetadata().setMetadata(this, metadataKey, newMetadataValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final float EPSILON = 0.005F;
|
private static final float EPSILON = 0.005F;
|
||||||
|
|
||||||
private static final Location LOADED_LOCATION = new Location(null, 0, 0, 0);
|
private static final Location LOADED_LOCATION = new Location(null, 0, 0, 0);
|
||||||
}
|
}
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityGhast;
|
import net.minecraft.server.v1_6_R1.EntityGhast;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftGhast;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftGhast;
|
||||||
import org.bukkit.entity.Ghast;
|
import org.bukkit.entity.Ghast;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -42,21 +42,21 @@ public class GhastController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bq() {
|
public void bh() {
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
npc.update();
|
npc.update();
|
||||||
} else
|
} else
|
||||||
super.bq();
|
super.bh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityGiantZombie;
|
import net.minecraft.server.v1_6_R1.EntityGiantZombie;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftGiant;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftGiant;
|
||||||
import org.bukkit.entity.Giant;
|
import org.bukkit.entity.Giant;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -42,15 +42,15 @@ public class GiantController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bq() {
|
public void bh() {
|
||||||
if (npc == null) {
|
if (npc == null) {
|
||||||
super.bq();
|
super.bh();
|
||||||
} else {
|
} else {
|
||||||
NMS.updateAI(this);
|
NMS.updateAI(this);
|
||||||
npc.update();
|
npc.update();
|
||||||
@ -58,7 +58,7 @@ public class GiantController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
@ -114,4 +114,5 @@ public class GiantController extends MobEntityController {
|
|||||||
return npc;
|
return npc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
115
src/main/java/net/citizensnpcs/npc/entity/HorseController.java
Normal file
115
src/main/java/net/citizensnpcs/npc/entity/HorseController.java
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
|
import net.citizensnpcs.npc.MobEntityController;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
|
import net.citizensnpcs.util.NMS;
|
||||||
|
import net.citizensnpcs.util.Util;
|
||||||
|
import net.minecraft.server.v1_6_R1.EntityHorse;
|
||||||
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftHorse;
|
||||||
|
import org.bukkit.entity.Horse;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
public class HorseController extends MobEntityController {
|
||||||
|
public HorseController() {
|
||||||
|
super(EntityHorseNPC.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Horse getBukkitEntity() {
|
||||||
|
return (Horse) super.getBukkitEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class EntityHorseNPC extends EntityHorse implements NPCHolder {
|
||||||
|
private final CitizensNPC npc;
|
||||||
|
|
||||||
|
public EntityHorseNPC(World world) {
|
||||||
|
this(world, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityHorseNPC(World world, NPC npc) {
|
||||||
|
super(world);
|
||||||
|
this.npc = (CitizensNPC) npc;
|
||||||
|
if (npc != null) {
|
||||||
|
NMS.clearGoals(goalSelector, targetSelector);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@Override
|
||||||
|
public float bE() {
|
||||||
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void c() {
|
||||||
|
if (npc == null) {
|
||||||
|
super.c();
|
||||||
|
} else
|
||||||
|
npc.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
if (npc != null)
|
||||||
|
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void g(double x, double y, double z) {
|
||||||
|
if (npc == null) {
|
||||||
|
super.g(x, y, z);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) {
|
||||||
|
if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true))
|
||||||
|
super.g(x, y, z);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Vector vector = new Vector(x, y, z);
|
||||||
|
NPCPushEvent event = Util.callPushEvent(npc, vector);
|
||||||
|
if (!event.isCancelled()) {
|
||||||
|
vector = event.getCollisionVector();
|
||||||
|
super.g(vector.getX(), vector.getY(), vector.getZ());
|
||||||
|
}
|
||||||
|
// when another entity collides, this method is called to push the
|
||||||
|
// NPC so we prevent it from doing anything if the event is
|
||||||
|
// cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CraftEntity getBukkitEntity() {
|
||||||
|
if (bukkitEntity == null && npc != null)
|
||||||
|
bukkitEntity = new HorseNPC(this);
|
||||||
|
return super.getBukkitEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return npc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class HorseNPC extends CraftHorse implements NPCHolder {
|
||||||
|
private final CitizensNPC npc;
|
||||||
|
|
||||||
|
public HorseNPC(EntityHorseNPC entity) {
|
||||||
|
super((CraftServer) Bukkit.getServer(), entity);
|
||||||
|
this.npc = entity.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return npc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,12 +6,12 @@ import net.citizensnpcs.api.npc.NPC;
|
|||||||
import net.citizensnpcs.api.util.Colorizer;
|
import net.citizensnpcs.api.util.Colorizer;
|
||||||
import net.citizensnpcs.npc.AbstractEntityController;
|
import net.citizensnpcs.npc.AbstractEntityController;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.minecraft.server.v1_5_R3.PlayerInteractManager;
|
import net.minecraft.server.v1_6_R1.PlayerInteractManager;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftWorld;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftWorld;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityIronGolem;
|
import net.minecraft.server.v1_6_R1.EntityIronGolem;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftIronGolem;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftIronGolem;
|
||||||
import org.bukkit.entity.IronGolem;
|
import org.bukkit.entity.IronGolem;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -42,20 +42,20 @@ public class IronGolemController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bo() {
|
public void be() {
|
||||||
super.bo();
|
super.be();
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityMagmaCube;
|
import net.minecraft.server.v1_6_R1.EntityMagmaCube;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftMagmaCube;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftMagmaCube;
|
||||||
import org.bukkit.entity.MagmaCube;
|
import org.bukkit.entity.MagmaCube;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -43,22 +43,22 @@ public class MagmaCubeController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/*@Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bo() {
|
public void be() {
|
||||||
super.bo();
|
super.be();
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bq() {
|
public void bh() {
|
||||||
if (npc == null)
|
if (npc == null)
|
||||||
super.bq();
|
super.bh();
|
||||||
else {
|
else {
|
||||||
NMS.updateAI(this);
|
NMS.updateAI(this);
|
||||||
npc.update();
|
npc.update();
|
||||||
@ -66,7 +66,7 @@ public class MagmaCubeController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityMushroomCow;
|
import net.minecraft.server.v1_6_R1.EntityMushroomCow;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftMushroomCow;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftMushroomCow;
|
||||||
import org.bukkit.entity.MushroomCow;
|
import org.bukkit.entity.MushroomCow;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -43,20 +43,20 @@ public class MushroomCowController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bo() {
|
public void be() {
|
||||||
super.bo();
|
super.be();
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityOcelot;
|
import net.minecraft.server.v1_6_R1.EntityOcelot;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftOcelot;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftOcelot;
|
||||||
import org.bukkit.entity.Ocelot;
|
import org.bukkit.entity.Ocelot;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -43,20 +43,20 @@ public class OcelotController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bo() {
|
public void be() {
|
||||||
super.bo();
|
super.be();
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,14 +7,14 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityLightning;
|
import net.minecraft.server.v1_6_R1.EntityLightning;
|
||||||
import net.minecraft.server.v1_5_R3.EntityPig;
|
import net.minecraft.server.v1_6_R1.EntityPig;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftPig;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftPig;
|
||||||
import org.bukkit.entity.Pig;
|
import org.bukkit.entity.Pig;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -49,20 +49,21 @@ public class PigController extends MobEntityController {
|
|||||||
super.a(entitylightning);
|
super.a(entitylightning);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bo() {
|
public void be() {
|
||||||
super.bo();
|
super.be();
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityPigZombie;
|
import net.minecraft.server.v1_6_R1.EntityPigZombie;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftPigZombie;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftPigZombie;
|
||||||
import org.bukkit.entity.PigZombie;
|
import org.bukkit.entity.PigZombie;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -43,22 +43,22 @@ public class PigZombieController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bo() {
|
public void be() {
|
||||||
super.bo();
|
super.be();
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bq() {
|
public void bh() {
|
||||||
if (npc == null) {
|
if (npc == null) {
|
||||||
super.bq();
|
super.bh();
|
||||||
} else {
|
} else {
|
||||||
NMS.updateAI(this);
|
NMS.updateAI(this);
|
||||||
npc.update();
|
npc.update();
|
||||||
@ -66,7 +66,7 @@ public class PigZombieController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntitySheep;
|
import net.minecraft.server.v1_6_R1.EntitySheep;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftSheep;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftSheep;
|
||||||
import org.bukkit.entity.Sheep;
|
import org.bukkit.entity.Sheep;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -43,20 +43,20 @@ public class SheepController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bo() {
|
public void be() {
|
||||||
super.bo();
|
super.be();
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntitySilverfish;
|
import net.minecraft.server.v1_6_R1.EntitySilverfish;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftSilverfish;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftSilverfish;
|
||||||
import org.bukkit.entity.Silverfish;
|
import org.bukkit.entity.Silverfish;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -43,22 +43,22 @@ public class SilverfishController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bo() {
|
public void be() {
|
||||||
super.bo();
|
super.be();
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bq() {
|
public void bh() {
|
||||||
if (npc == null) {
|
if (npc == null) {
|
||||||
super.bq();
|
super.bh();
|
||||||
} else {
|
} else {
|
||||||
NMS.updateAI(this);
|
NMS.updateAI(this);
|
||||||
npc.update();
|
npc.update();
|
||||||
@ -66,7 +66,7 @@ public class SilverfishController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntitySkeleton;
|
import net.minecraft.server.v1_6_R1.EntitySkeleton;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftSkeleton;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftSkeleton;
|
||||||
import org.bukkit.entity.Skeleton;
|
import org.bukkit.entity.Skeleton;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -42,20 +42,20 @@ public class SkeletonController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* @Override
|
||||||
|
public float bE() {
|
||||||
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
|
}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public float bE() {
|
public void be() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
super.be();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void bo() {
|
|
||||||
super.bo();
|
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntitySlime;
|
import net.minecraft.server.v1_6_R1.EntitySlime;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftSlime;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftSlime;
|
||||||
import org.bukkit.entity.Slime;
|
import org.bukkit.entity.Slime;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -44,22 +44,22 @@ public class SlimeController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/*@Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bo() {
|
public void be() {
|
||||||
super.bo();
|
super.be();
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bq() {
|
public void bh() {
|
||||||
if (npc == null) {
|
if (npc == null) {
|
||||||
super.bq();
|
super.bh();
|
||||||
} else {
|
} else {
|
||||||
npc.update();
|
npc.update();
|
||||||
NMS.updateAI(this);
|
NMS.updateAI(this);
|
||||||
@ -67,7 +67,7 @@ public class SlimeController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntitySnowman;
|
import net.minecraft.server.v1_6_R1.EntitySnowman;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftSnowman;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftSnowman;
|
||||||
import org.bukkit.entity.Snowman;
|
import org.bukkit.entity.Snowman;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -42,20 +42,20 @@ public class SnowmanController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bo() {
|
public void be() {
|
||||||
super.bo();
|
super.be();
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntitySpider;
|
import net.minecraft.server.v1_6_R1.EntitySpider;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftSpider;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftSpider;
|
||||||
import org.bukkit.entity.Spider;
|
import org.bukkit.entity.Spider;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -42,22 +42,22 @@ public class SpiderController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bo() {
|
public void be() {
|
||||||
super.bo();
|
super.be();
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bq() {
|
public void bh() {
|
||||||
if (npc == null)
|
if (npc == null)
|
||||||
super.bq();
|
super.bh();
|
||||||
else {
|
else {
|
||||||
NMS.updateAI(this);
|
NMS.updateAI(this);
|
||||||
npc.update();
|
npc.update();
|
||||||
@ -65,7 +65,7 @@ public class SpiderController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntitySquid;
|
import net.minecraft.server.v1_6_R1.EntitySquid;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftSquid;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftSquid;
|
||||||
import org.bukkit.entity.Squid;
|
import org.bukkit.entity.Squid;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -42,21 +42,21 @@ public class SquidController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bq() {
|
public void bh() {
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
npc.update();
|
npc.update();
|
||||||
} else
|
} else
|
||||||
super.bq();
|
super.bh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,14 +7,14 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityHuman;
|
import net.minecraft.server.v1_6_R1.EntityHuman;
|
||||||
import net.minecraft.server.v1_5_R3.EntityVillager;
|
import net.minecraft.server.v1_6_R1.EntityVillager;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftVillager;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftVillager;
|
||||||
import org.bukkit.entity.Villager;
|
import org.bukkit.entity.Villager;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -45,25 +45,25 @@ public class VillagerController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean a_(EntityHuman entityhuman) {
|
public boolean a(EntityHuman entityhuman) {
|
||||||
return npc == null || !blockTrades ? super.a_(entityhuman) : false; // block
|
return npc == null || !blockTrades ? super.a(entityhuman) : false; // block
|
||||||
// trades
|
// trades
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bo() {
|
public void be() {
|
||||||
super.bo();
|
super.be();
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityWitch;
|
import net.minecraft.server.v1_6_R1.EntityWitch;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftWitch;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftWitch;
|
||||||
import org.bukkit.entity.Witch;
|
import org.bukkit.entity.Witch;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -43,19 +43,19 @@ public class WitchController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float bE() {
|
public void be() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
super.be();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void bo() {
|
|
||||||
super.bo();
|
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* @Override
|
||||||
|
public float bE() {
|
||||||
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityWither;
|
import net.minecraft.server.v1_6_R1.EntityWither;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftWither;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftWither;
|
||||||
import org.bukkit.entity.Wither;
|
import org.bukkit.entity.Wither;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -42,14 +42,14 @@ public class WitherController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/*@Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bo() {
|
public void be() {
|
||||||
super.bo();
|
super.be();
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ public class WitherController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityWolf;
|
import net.minecraft.server.v1_6_R1.EntityWolf;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftWolf;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftWolf;
|
||||||
import org.bukkit.entity.Wolf;
|
import org.bukkit.entity.Wolf;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -42,20 +42,20 @@ public class WolfController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bo() {
|
public void be() {
|
||||||
super.bo();
|
super.be();
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -7,13 +7,13 @@ import net.citizensnpcs.npc.MobEntityController;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityZombie;
|
import net.minecraft.server.v1_6_R1.EntityZombie;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftZombie;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftZombie;
|
||||||
import org.bukkit.entity.Zombie;
|
import org.bukkit.entity.Zombie;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -42,20 +42,20 @@ public class ZombieController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public float bE() {
|
public float bE() {
|
||||||
return NMS.modifiedSpeed(super.bE(), npc);
|
return NMS.modifiedSpeed(super.bE(), npc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bo() {
|
public void be() {
|
||||||
super.bo();
|
super.be();
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
|
public void collide(net.minecraft.server.v1_6_R1.Entity entity) {
|
||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
package net.citizensnpcs.npc.network;
|
package net.citizensnpcs.npc.network;
|
||||||
|
|
||||||
import net.minecraft.server.v1_5_R3.EntityPlayer;
|
import net.minecraft.server.v1_6_R1.EntityPlayer;
|
||||||
import net.minecraft.server.v1_5_R3.MinecraftServer;
|
import net.minecraft.server.v1_6_R1.MinecraftServer;
|
||||||
import net.minecraft.server.v1_5_R3.NetworkManager;
|
import net.minecraft.server.v1_6_R1.NetworkManager;
|
||||||
import net.minecraft.server.v1_5_R3.Packet;
|
import net.minecraft.server.v1_6_R1.Packet;
|
||||||
import net.minecraft.server.v1_5_R3.Packet102WindowClick;
|
import net.minecraft.server.v1_6_R1.Packet102WindowClick;
|
||||||
import net.minecraft.server.v1_5_R3.Packet106Transaction;
|
import net.minecraft.server.v1_6_R1.Packet106Transaction;
|
||||||
import net.minecraft.server.v1_5_R3.Packet10Flying;
|
import net.minecraft.server.v1_6_R1.Packet10Flying;
|
||||||
import net.minecraft.server.v1_5_R3.Packet130UpdateSign;
|
import net.minecraft.server.v1_6_R1.Packet130UpdateSign;
|
||||||
import net.minecraft.server.v1_5_R3.Packet14BlockDig;
|
import net.minecraft.server.v1_6_R1.Packet14BlockDig;
|
||||||
import net.minecraft.server.v1_5_R3.Packet15Place;
|
import net.minecraft.server.v1_6_R1.Packet15Place;
|
||||||
import net.minecraft.server.v1_5_R3.Packet16BlockItemSwitch;
|
import net.minecraft.server.v1_6_R1.Packet16BlockItemSwitch;
|
||||||
import net.minecraft.server.v1_5_R3.Packet255KickDisconnect;
|
import net.minecraft.server.v1_6_R1.Packet255KickDisconnect;
|
||||||
import net.minecraft.server.v1_5_R3.Packet28EntityVelocity;
|
import net.minecraft.server.v1_6_R1.Packet28EntityVelocity;
|
||||||
import net.minecraft.server.v1_5_R3.Packet3Chat;
|
import net.minecraft.server.v1_6_R1.Packet3Chat;
|
||||||
import net.minecraft.server.v1_5_R3.Packet51MapChunk;
|
import net.minecraft.server.v1_6_R1.Packet51MapChunk;
|
||||||
import net.minecraft.server.v1_5_R3.PlayerConnection;
|
import net.minecraft.server.v1_6_R1.PlayerConnection;
|
||||||
|
|
||||||
public class EmptyNetHandler extends PlayerConnection {
|
public class EmptyNetHandler extends PlayerConnection {
|
||||||
public EmptyNetHandler(MinecraftServer minecraftServer, NetworkManager networkManager, EntityPlayer entityPlayer) {
|
public EmptyNetHandler(MinecraftServer minecraftServer, NetworkManager networkManager, EntityPlayer entityPlayer) {
|
||||||
|
@ -5,10 +5,10 @@ import java.net.Socket;
|
|||||||
import java.security.PrivateKey;
|
import java.security.PrivateKey;
|
||||||
|
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.minecraft.server.v1_5_R3.Connection;
|
import net.minecraft.server.v1_6_R1.Connection;
|
||||||
import net.minecraft.server.v1_5_R3.IConsoleLogManager;
|
import net.minecraft.server.v1_6_R1.IConsoleLogManager;
|
||||||
import net.minecraft.server.v1_5_R3.NetworkManager;
|
import net.minecraft.server.v1_6_R1.NetworkManager;
|
||||||
import net.minecraft.server.v1_5_R3.Packet;
|
import net.minecraft.server.v1_6_R1.Packet;
|
||||||
|
|
||||||
public class EmptyNetworkManager extends NetworkManager {
|
public class EmptyNetworkManager extends NetworkManager {
|
||||||
public EmptyNetworkManager(IConsoleLogManager logManager, Socket socket, String string, Connection conn,
|
public EmptyNetworkManager(IConsoleLogManager logManager, Socket socket, String string, Connection conn,
|
||||||
|
@ -14,12 +14,12 @@ import net.citizensnpcs.api.trait.trait.Owner;
|
|||||||
import net.citizensnpcs.api.util.DataKey;
|
import net.citizensnpcs.api.util.DataKey;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_5_R3.EntityEnderDragon;
|
import net.minecraft.server.v1_6_R1.EntityEnderDragon;
|
||||||
import net.minecraft.server.v1_5_R3.EntityLiving;
|
import net.minecraft.server.v1_6_R1.EntityLiving;
|
||||||
import net.minecraft.server.v1_5_R3.EntityPlayer;
|
import net.minecraft.server.v1_6_R1.EntityPlayer;
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftLivingEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftLivingEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -226,6 +226,8 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class GroundController implements MovementController {
|
public class GroundController implements MovementController {
|
||||||
|
private double speed = 0.07D;
|
||||||
|
|
||||||
private void jump() {
|
private void jump() {
|
||||||
boolean allowed = getHandle().onGround;
|
boolean allowed = getHandle().onGround;
|
||||||
if (!allowed)
|
if (!allowed)
|
||||||
@ -253,9 +255,36 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
|
|||||||
boolean onGround = handle.onGround;
|
boolean onGround = handle.onGround;
|
||||||
float speedMod = npc.getNavigator().getDefaultParameters()
|
float speedMod = npc.getNavigator().getDefaultParameters()
|
||||||
.modifiedSpeed((onGround ? GROUND_SPEED : AIR_SPEED));
|
.modifiedSpeed((onGround ? GROUND_SPEED : AIR_SPEED));
|
||||||
|
|
||||||
|
updateSpeed(handle, speedMod);
|
||||||
|
setMountedYaw(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateSpeed(EntityLiving handle, float speedMod) {
|
||||||
|
double oldSpeed = Math.sqrt(handle.motX * handle.motX + handle.motZ * handle.motZ);
|
||||||
|
double horizontal = ((EntityLiving) handle.passenger).bf;
|
||||||
|
if (horizontal > 0.0D) {
|
||||||
|
double dXcos = -Math.sin(handle.passenger.yaw * Math.PI / 180.0F);
|
||||||
|
double dXsin = Math.cos(handle.passenger.yaw * Math.PI / 180.0F);
|
||||||
|
handle.motX += dXcos * this.speed * 0.05;
|
||||||
|
handle.motZ += dXsin * this.speed * 0.05;
|
||||||
|
}
|
||||||
handle.motX += handle.passenger.motX * speedMod;
|
handle.motX += handle.passenger.motX * speedMod;
|
||||||
handle.motZ += handle.passenger.motZ * speedMod;
|
handle.motZ += handle.passenger.motZ * speedMod;
|
||||||
setMountedYaw(handle);
|
|
||||||
|
double newSpeed = Math.sqrt(handle.motX * handle.motX + handle.motZ * handle.motZ);
|
||||||
|
if (newSpeed > 0.35D) {
|
||||||
|
double movementFactor = 0.35D / newSpeed;
|
||||||
|
handle.motX *= movementFactor;
|
||||||
|
handle.motZ *= movementFactor;
|
||||||
|
newSpeed = 0.35D;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newSpeed > oldSpeed && this.speed < 0.35D) {
|
||||||
|
this.speed = Math.min(0.35D, (this.speed + ((0.35D - this.speed) / 35.0D)));
|
||||||
|
} else {
|
||||||
|
this.speed = Math.max(0.07D, (this.speed - ((this.speed - 0.07D) / 35.0D)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final float AIR_SPEED = 1.5F;
|
private static final float AIR_SPEED = 1.5F;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package net.citizensnpcs.trait.waypoint;
|
package net.citizensnpcs.trait.waypoint;
|
||||||
|
|
||||||
import net.minecraft.server.v1_5_R3.DamageSource;
|
import net.minecraft.server.v1_6_R1.DamageSource;
|
||||||
import net.minecraft.server.v1_5_R3.EntityEnderCrystal;
|
import net.minecraft.server.v1_6_R1.EntityEnderCrystal;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
public class EntityEnderCrystalMarker extends EntityEnderCrystal {
|
public class EntityEnderCrystalMarker extends EntityEnderCrystal {
|
||||||
public EntityEnderCrystalMarker(World world) {
|
public EntityEnderCrystalMarker(World world) {
|
||||||
@ -10,16 +10,16 @@ public class EntityEnderCrystalMarker extends EntityEnderCrystal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
public boolean damageEntity(DamageSource damagesource, float i) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void l_() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean K() {
|
public boolean K() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void l_() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -382,8 +382,9 @@ public class LinearWaypointProvider implements WaypointProvider {
|
|||||||
|
|
||||||
public void onProviderChanged() {
|
public void onProviderChanged() {
|
||||||
itr = waypoints.iterator();
|
itr = waypoints.iterator();
|
||||||
if (currentDestination != null)
|
if (currentDestination != null) {
|
||||||
selector.finish();
|
selector.finish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -394,13 +395,15 @@ public class LinearWaypointProvider implements WaypointProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(GoalSelector selector) {
|
public void run(GoalSelector selector) {
|
||||||
if (!getNavigator().isNavigating())
|
if (!getNavigator().isNavigating()) {
|
||||||
selector.finish();
|
selector.finish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPaused(boolean pause) {
|
public void setPaused(boolean pause) {
|
||||||
if (pause && currentDestination != null)
|
if (pause && currentDestination != null) {
|
||||||
selector.finish();
|
selector.finish();
|
||||||
|
}
|
||||||
paused = pause;
|
paused = pause;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -417,7 +420,9 @@ public class LinearWaypointProvider implements WaypointProvider {
|
|||||||
this.selector = selector;
|
this.selector = selector;
|
||||||
Waypoint next = itr.next();
|
Waypoint next = itr.next();
|
||||||
Location npcLoc = npc.getBukkitEntity().getLocation(cachedLocation);
|
Location npcLoc = npc.getBukkitEntity().getLocation(cachedLocation);
|
||||||
if (npcLoc.getWorld() != next.getLocation().getWorld() || npcLoc.distanceSquared(next.getLocation()) < 3) {
|
if (npcLoc.getWorld() != next.getLocation().getWorld()
|
||||||
|
|| npcLoc.distanceSquared(next.getLocation()) < npc.getNavigator().getLocalParameters()
|
||||||
|
.distanceMargin()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
currentDestination = next;
|
currentDestination = next;
|
||||||
|
@ -134,9 +134,9 @@ public class ByIdArray<T> implements Iterable<T> {
|
|||||||
private int idx;
|
private int idx;
|
||||||
{
|
{
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
if (highest == Integer.MIN_VALUE || elementData[highest] == null)
|
if (highest == Integer.MIN_VALUE || highest >= elementData.length || elementData[highest] == null)
|
||||||
recalcHighest();
|
recalcHighest();
|
||||||
if (lowest == Integer.MAX_VALUE || elementData[lowest] == null)
|
if (lowest >= elementData.length || elementData[lowest] == null)
|
||||||
recalcLowest();
|
recalcLowest();
|
||||||
idx = lowest - 1;
|
idx = lowest - 1;
|
||||||
}
|
}
|
||||||
|
@ -11,31 +11,33 @@ import java.util.WeakHashMap;
|
|||||||
|
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.api.util.Messaging;
|
import net.citizensnpcs.api.util.Messaging;
|
||||||
import net.minecraft.server.v1_5_R3.ControllerJump;
|
import net.citizensnpcs.npc.entity.EntityHumanNPC;
|
||||||
import net.minecraft.server.v1_5_R3.DamageSource;
|
import net.minecraft.server.v1_6_R1.ControllerJump;
|
||||||
import net.minecraft.server.v1_5_R3.EnchantmentManager;
|
import net.minecraft.server.v1_6_R1.DamageSource;
|
||||||
import net.minecraft.server.v1_5_R3.Entity;
|
import net.minecraft.server.v1_6_R1.EnchantmentManager;
|
||||||
import net.minecraft.server.v1_5_R3.EntityHuman;
|
import net.minecraft.server.v1_6_R1.Entity;
|
||||||
import net.minecraft.server.v1_5_R3.EntityLiving;
|
import net.minecraft.server.v1_6_R1.EntityHuman;
|
||||||
import net.minecraft.server.v1_5_R3.EntityMonster;
|
import net.minecraft.server.v1_6_R1.EntityInsentient;
|
||||||
import net.minecraft.server.v1_5_R3.EntityPlayer;
|
import net.minecraft.server.v1_6_R1.EntityLiving;
|
||||||
import net.minecraft.server.v1_5_R3.EntityTypes;
|
import net.minecraft.server.v1_6_R1.EntityPlayer;
|
||||||
import net.minecraft.server.v1_5_R3.MathHelper;
|
import net.minecraft.server.v1_6_R1.EntityTypes;
|
||||||
import net.minecraft.server.v1_5_R3.MobEffectList;
|
import net.minecraft.server.v1_6_R1.GenericAttributes;
|
||||||
import net.minecraft.server.v1_5_R3.Navigation;
|
import net.minecraft.server.v1_6_R1.MathHelper;
|
||||||
import net.minecraft.server.v1_5_R3.NetworkManager;
|
import net.minecraft.server.v1_6_R1.MobEffectList;
|
||||||
import net.minecraft.server.v1_5_R3.Packet;
|
import net.minecraft.server.v1_6_R1.Navigation;
|
||||||
import net.minecraft.server.v1_5_R3.PathfinderGoalSelector;
|
import net.minecraft.server.v1_6_R1.NetworkManager;
|
||||||
import net.minecraft.server.v1_5_R3.World;
|
import net.minecraft.server.v1_6_R1.Packet;
|
||||||
|
import net.minecraft.server.v1_6_R1.PathfinderGoalSelector;
|
||||||
|
import net.minecraft.server.v1_6_R1.World;
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.CraftWorld;
|
import org.bukkit.craftbukkit.v1_6_R1.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftLivingEntity;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftLivingEntity;
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -49,20 +51,6 @@ public class NMS {
|
|||||||
// util class
|
// util class
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final float DEFAULT_SPEED = 0.4F;
|
|
||||||
private static Map<Class<?>, Integer> ENTITY_CLASS_TO_INT;
|
|
||||||
private static final Map<Class<?>, Constructor<?>> ENTITY_CONSTRUCTOR_CACHE = new WeakHashMap<Class<?>, Constructor<?>>();
|
|
||||||
private static Map<Integer, Class<?>> ENTITY_INT_TO_CLASS;
|
|
||||||
private static Field GOAL_FIELD;
|
|
||||||
private static Field LAND_SPEED_MODIFIER_FIELD;
|
|
||||||
private static final Map<EntityType, Float> MOVEMENT_SPEEDS = Maps.newEnumMap(EntityType.class);
|
|
||||||
private static Field NAVIGATION_WORLD_FIELD;
|
|
||||||
private static final Location packetCacheLocation = new Location(null, 0, 0, 0);
|
|
||||||
private static Field PATHFINDING_RANGE;
|
|
||||||
private static final Random RANDOM = Util.getFastRandom();
|
|
||||||
private static Field SPEED_FIELD;
|
|
||||||
private static Field THREAD_STOPPER;
|
|
||||||
|
|
||||||
public static void addOrRemoveFromPlayerList(LivingEntity bukkitEntity, boolean remove) {
|
public static void addOrRemoveFromPlayerList(LivingEntity bukkitEntity, boolean remove) {
|
||||||
if (bukkitEntity == null)
|
if (bukkitEntity == null)
|
||||||
return;
|
return;
|
||||||
@ -77,7 +65,7 @@ public class NMS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void attack(EntityLiving handle, Entity target) {
|
public static void attack(EntityLiving handle, Entity target) {
|
||||||
int damage = handle instanceof EntityMonster ? ((EntityMonster) handle).c(target) : 2;
|
float damage = (float) handle.a(GenericAttributes.e).e();
|
||||||
|
|
||||||
if (handle.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
|
if (handle.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
|
||||||
damage += 3 << handle.getEffect(MobEffectList.INCREASE_DAMAGE).getAmplifier();
|
damage += 3 << handle.getEffect(MobEffectList.INCREASE_DAMAGE).getAmplifier();
|
||||||
@ -179,12 +167,20 @@ public class NMS {
|
|||||||
return mcEntity.G() || mcEntity.I();
|
return mcEntity.G() || mcEntity.I();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isSentient(LivingEntity entity) {
|
||||||
|
return !(((CraftLivingEntity) entity).getHandle() instanceof EntityInsentient);
|
||||||
|
}
|
||||||
|
|
||||||
public static void loadPlugins() {
|
public static void loadPlugins() {
|
||||||
((CraftServer) Bukkit.getServer()).enablePlugins(PluginLoadOrder.POSTWORLD);
|
((CraftServer) Bukkit.getServer()).enablePlugins(PluginLoadOrder.POSTWORLD);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void look(EntityLiving handle, Entity target) {
|
public static void look(EntityLiving handle, Entity target) {
|
||||||
handle.getControllerLook().a(target, 10.0F, handle.bs());
|
if (handle instanceof EntityInsentient) {
|
||||||
|
((EntityInsentient) handle).getControllerLook().a(target, 10.0F, ((EntityInsentient) handle).bl());
|
||||||
|
} else if (handle instanceof EntityHumanNPC) {
|
||||||
|
((EntityHumanNPC) handle).setTargetLook(target, 10F, 40);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void look(LivingEntity bukkitEntity, float yaw, float pitch) {
|
public static void look(LivingEntity bukkitEntity, float yaw, float pitch) {
|
||||||
@ -237,7 +233,7 @@ public class NMS {
|
|||||||
if (ply == null || world != ply.getWorld()) {
|
if (ply == null || world != ply.getWorld()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (location.distanceSquared(ply.getLocation(packetCacheLocation)) > radius) {
|
if (location.distanceSquared(ply.getLocation(PACKET_CACHE_LOCATION)) > radius) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (Packet packet : packets) {
|
for (Packet packet : packets) {
|
||||||
@ -262,7 +258,12 @@ public class NMS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setDestination(LivingEntity bukkitEntity, double x, double y, double z, float speed) {
|
public static void setDestination(LivingEntity bukkitEntity, double x, double y, double z, float speed) {
|
||||||
((CraftLivingEntity) bukkitEntity).getHandle().getControllerMove().a(x, y, z, speed);
|
EntityLiving handle = ((CraftLivingEntity) bukkitEntity).getHandle();
|
||||||
|
if (handle instanceof EntityInsentient) {
|
||||||
|
((EntityInsentient) handle).getControllerMove().a(x, y, z, speed);
|
||||||
|
} else if (handle instanceof EntityHumanNPC) {
|
||||||
|
((EntityHumanNPC) handle).setMoveDestination(x, y, z, speed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setHeadYaw(EntityLiving handle, float yaw) {
|
public static void setHeadYaw(EntityLiving handle, float yaw) {
|
||||||
@ -273,10 +274,10 @@ public class NMS {
|
|||||||
while (yaw >= 180.0F) {
|
while (yaw >= 180.0F) {
|
||||||
yaw -= 360.0F;
|
yaw -= 360.0F;
|
||||||
}
|
}
|
||||||
handle.aA = yaw;
|
handle.aP = yaw;
|
||||||
if (!(handle instanceof EntityHuman))
|
if (!(handle instanceof EntityHuman))
|
||||||
handle.ay = yaw;
|
handle.aN = yaw;
|
||||||
handle.aB = yaw;
|
handle.aQ = yaw;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setLandSpeedModifier(EntityLiving handle, float speed) {
|
public static void setLandSpeedModifier(EntityLiving handle, float speed) {
|
||||||
@ -290,8 +291,13 @@ public class NMS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setShouldJump(LivingEntity entity) {
|
public static void setShouldJump(LivingEntity entity) {
|
||||||
ControllerJump controller = getHandle(entity).getControllerJump();
|
EntityLiving handle = getHandle(entity);
|
||||||
controller.a();
|
if (handle instanceof EntityInsentient) {
|
||||||
|
ControllerJump controller = ((EntityInsentient) handle).getControllerJump();
|
||||||
|
controller.a();
|
||||||
|
} else if (handle instanceof EntityHumanNPC) {
|
||||||
|
((EntityHumanNPC) handle).setShouldJump();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static org.bukkit.entity.Entity spawnCustomEntity(org.bukkit.World world, Location at,
|
public static org.bukkit.entity.Entity spawnCustomEntity(org.bukkit.World world, Location at,
|
||||||
@ -332,17 +338,25 @@ public class NMS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void updateAI(EntityLiving entity) {
|
public static void updateAI(EntityLiving entity) {
|
||||||
updateSenses(entity);
|
if (entity instanceof EntityInsentient) {
|
||||||
entity.getNavigation().e();
|
EntityInsentient handle = (EntityInsentient) entity;
|
||||||
entity.getControllerMove().c();
|
handle.getEntitySenses().a();
|
||||||
entity.getControllerLook().a();
|
handle.getNavigation().e();
|
||||||
entity.getControllerJump().b();
|
handle.getControllerMove().c();
|
||||||
|
handle.getControllerLook().a();
|
||||||
|
handle.getControllerJump().b();
|
||||||
|
} else if (entity instanceof EntityHumanNPC) {
|
||||||
|
((EntityHumanNPC) entity).updateAI();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateNavigationWorld(LivingEntity entity, org.bukkit.World world) {
|
public static void updateNavigationWorld(LivingEntity entity, org.bukkit.World world) {
|
||||||
if (NAVIGATION_WORLD_FIELD == null)
|
if (NAVIGATION_WORLD_FIELD == null)
|
||||||
return;
|
return;
|
||||||
EntityLiving handle = ((CraftLivingEntity) entity).getHandle();
|
EntityLiving en = ((CraftLivingEntity) entity).getHandle();
|
||||||
|
if (!(en instanceof EntityInsentient))
|
||||||
|
return;
|
||||||
|
EntityInsentient handle = (EntityInsentient) en;
|
||||||
World worldHandle = ((CraftWorld) world).getHandle();
|
World worldHandle = ((CraftWorld) world).getHandle();
|
||||||
try {
|
try {
|
||||||
NAVIGATION_WORLD_FIELD.set(handle.getNavigation(), worldHandle);
|
NAVIGATION_WORLD_FIELD.set(handle.getNavigation(), worldHandle);
|
||||||
@ -352,9 +366,13 @@ public class NMS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void updatePathfindingRange(NPC npc, float pathfindingRange) {
|
public static void updatePathfindingRange(NPC npc, float pathfindingRange) {
|
||||||
if (PATHFINDING_RANGE == null)
|
if (PATHFINDING_RANGE == null || !npc.isSpawned())
|
||||||
return;
|
return;
|
||||||
Navigation navigation = ((CraftLivingEntity) npc.getBukkitEntity()).getHandle().getNavigation();
|
EntityLiving en = ((CraftLivingEntity) npc.getBukkitEntity()).getHandle();
|
||||||
|
if (!(en instanceof EntityInsentient))
|
||||||
|
return;
|
||||||
|
EntityInsentient handle = (EntityInsentient) en;
|
||||||
|
Navigation navigation = handle.getNavigation();
|
||||||
try {
|
try {
|
||||||
PATHFINDING_RANGE.set(navigation, pathfindingRange);
|
PATHFINDING_RANGE.set(navigation, pathfindingRange);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -362,31 +380,43 @@ public class NMS {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateSenses(EntityLiving entity) {
|
private static final float DEFAULT_SPEED = 1F;
|
||||||
entity.getEntitySenses().a();
|
private static Map<Class<?>, Integer> ENTITY_CLASS_TO_INT;
|
||||||
}
|
private static final Map<Class<?>, Constructor<?>> ENTITY_CONSTRUCTOR_CACHE = new WeakHashMap<Class<?>, Constructor<?>>();
|
||||||
|
private static Map<Integer, Class<?>> ENTITY_INT_TO_CLASS;
|
||||||
|
private static Field GOAL_FIELD;
|
||||||
|
private static Field LAND_SPEED_MODIFIER_FIELD;
|
||||||
|
private static final Map<EntityType, Float> MOVEMENT_SPEEDS = Maps.newEnumMap(EntityType.class);
|
||||||
|
private static Field NAVIGATION_WORLD_FIELD;
|
||||||
|
private static final Location PACKET_CACHE_LOCATION = new Location(null, 0, 0, 0);
|
||||||
|
private static Field PATHFINDING_RANGE;
|
||||||
|
private static final Random RANDOM = Util.getFastRandom();
|
||||||
|
private static Field SPEED_FIELD;
|
||||||
|
|
||||||
|
private static Field THREAD_STOPPER;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
// TODO: speed fields are all wrong - need to use attributes
|
||||||
|
|
||||||
// true field above false and three synchronised lists
|
// true field above false and three synchronised lists
|
||||||
THREAD_STOPPER = getField(NetworkManager.class, "n");
|
THREAD_STOPPER = getField(NetworkManager.class, "n");
|
||||||
|
|
||||||
// constants taken from source code
|
// constants taken from source code
|
||||||
MOVEMENT_SPEEDS.put(EntityType.CHICKEN, 0.25F);
|
MOVEMENT_SPEEDS.put(EntityType.CHICKEN, 1F);
|
||||||
MOVEMENT_SPEEDS.put(EntityType.COW, 0.2F);
|
MOVEMENT_SPEEDS.put(EntityType.COW, 1F);
|
||||||
MOVEMENT_SPEEDS.put(EntityType.CREEPER, 0.3F);
|
MOVEMENT_SPEEDS.put(EntityType.CREEPER, 1F);
|
||||||
MOVEMENT_SPEEDS.put(EntityType.IRON_GOLEM, 0.15F);
|
MOVEMENT_SPEEDS.put(EntityType.IRON_GOLEM, 1F);
|
||||||
MOVEMENT_SPEEDS.put(EntityType.MUSHROOM_COW, 0.2F);
|
MOVEMENT_SPEEDS.put(EntityType.MUSHROOM_COW, 1F);
|
||||||
MOVEMENT_SPEEDS.put(EntityType.OCELOT, 0.23F);
|
MOVEMENT_SPEEDS.put(EntityType.OCELOT, 1F);
|
||||||
MOVEMENT_SPEEDS.put(EntityType.SHEEP, 0.25F);
|
MOVEMENT_SPEEDS.put(EntityType.SHEEP, 1F);
|
||||||
MOVEMENT_SPEEDS.put(EntityType.SNOWMAN, 0.25F);
|
MOVEMENT_SPEEDS.put(EntityType.SNOWMAN, 1F);
|
||||||
MOVEMENT_SPEEDS.put(EntityType.PIG, 0.27F);
|
MOVEMENT_SPEEDS.put(EntityType.PIG, 1F);
|
||||||
MOVEMENT_SPEEDS.put(EntityType.PLAYER, 1F);
|
MOVEMENT_SPEEDS.put(EntityType.PLAYER, 1F);
|
||||||
MOVEMENT_SPEEDS.put(EntityType.VILLAGER, 0.3F);
|
MOVEMENT_SPEEDS.put(EntityType.VILLAGER, 1F);
|
||||||
|
LAND_SPEED_MODIFIER_FIELD = getField(EntityLiving.class, "bs");
|
||||||
LAND_SPEED_MODIFIER_FIELD = getField(EntityLiving.class, "bQ");
|
|
||||||
SPEED_FIELD = getField(EntityLiving.class, "bI");
|
SPEED_FIELD = getField(EntityLiving.class, "bI");
|
||||||
NAVIGATION_WORLD_FIELD = getField(Navigation.class, "b");
|
NAVIGATION_WORLD_FIELD = getField(Navigation.class, "b");
|
||||||
PATHFINDING_RANGE = getField(Navigation.class, "e");
|
PATHFINDING_RANGE = getField(Navigation.class, "d");
|
||||||
GOAL_FIELD = getField(PathfinderGoalSelector.class, "a");
|
GOAL_FIELD = getField(PathfinderGoalSelector.class, "a");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -2,13 +2,13 @@ package net.citizensnpcs.util;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import net.minecraft.server.v1_5_R3.EntityPlayer;
|
import net.minecraft.server.v1_6_R1.EntityPlayer;
|
||||||
import net.minecraft.server.v1_5_R3.Packet;
|
import net.minecraft.server.v1_6_R1.Packet;
|
||||||
import net.minecraft.server.v1_5_R3.Packet17EntityLocationAction;
|
import net.minecraft.server.v1_6_R1.Packet17EntityLocationAction;
|
||||||
import net.minecraft.server.v1_5_R3.Packet18ArmAnimation;
|
import net.minecraft.server.v1_6_R1.Packet18ArmAnimation;
|
||||||
import net.minecraft.server.v1_5_R3.Packet40EntityMetadata;
|
import net.minecraft.server.v1_6_R1.Packet40EntityMetadata;
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public enum PlayerAnimation {
|
public enum PlayerAnimation {
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
package net.citizensnpcs.util.nms;
|
||||||
|
|
||||||
|
import net.citizensnpcs.npc.entity.EntityHumanNPC;
|
||||||
|
|
||||||
|
public class PlayerControllerJump {
|
||||||
|
private final EntityHumanNPC a;
|
||||||
|
private boolean b;
|
||||||
|
|
||||||
|
public PlayerControllerJump(EntityHumanNPC entityinsentient) {
|
||||||
|
this.a = entityinsentient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void a() {
|
||||||
|
this.b = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void b() {
|
||||||
|
this.a.f(this.b);
|
||||||
|
this.b = false;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
package net.citizensnpcs.util.nms;
|
||||||
|
|
||||||
|
import net.citizensnpcs.npc.entity.EntityHumanNPC;
|
||||||
|
import net.minecraft.server.v1_6_R1.Entity;
|
||||||
|
import net.minecraft.server.v1_6_R1.EntityLiving;
|
||||||
|
import net.minecraft.server.v1_6_R1.MathHelper;
|
||||||
|
|
||||||
|
public class PlayerControllerLook {
|
||||||
|
private final EntityHumanNPC a;
|
||||||
|
private float b;
|
||||||
|
private float c;
|
||||||
|
private boolean d;
|
||||||
|
private double e;
|
||||||
|
private double f;
|
||||||
|
private double g;
|
||||||
|
|
||||||
|
public PlayerControllerLook(EntityHumanNPC entityinsentient) {
|
||||||
|
this.a = entityinsentient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void a() {
|
||||||
|
this.a.pitch = 0.0F;
|
||||||
|
if (this.d) {
|
||||||
|
this.d = false;
|
||||||
|
double d0 = this.e - this.a.locX;
|
||||||
|
double d1 = this.f - (this.a.locY + this.a.getHeadHeight());
|
||||||
|
double d2 = this.g - this.a.locZ;
|
||||||
|
double d3 = Math.sqrt(d0 * d0 + d2 * d2);
|
||||||
|
float f = (float) (Math.atan2(d2, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||||
|
float f1 = (float) (-(Math.atan2(d1, d3) * 180.0D / 3.1415927410125732D));
|
||||||
|
|
||||||
|
this.a.pitch = this.a(this.a.pitch, f1, this.c);
|
||||||
|
this.a.aP = this.a(this.a.aP, f, this.b);
|
||||||
|
} else {
|
||||||
|
this.a.aP = this.a(this.a.aP, this.a.aN, 10.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
float f2 = MathHelper.g(this.a.aP - this.a.aN);
|
||||||
|
|
||||||
|
if (!this.a.isNavigating()) {
|
||||||
|
if (f2 < -75.0F) {
|
||||||
|
this.a.aP = this.a.aN - 75.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f2 > 75.0F) {
|
||||||
|
this.a.aP = this.a.aN + 75.0F;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void a(double d0, double d1, double d2, float f, float f1) {
|
||||||
|
this.e = d0;
|
||||||
|
this.f = d1;
|
||||||
|
this.g = d2;
|
||||||
|
this.b = f;
|
||||||
|
this.c = f1;
|
||||||
|
this.d = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void a(Entity entity, float f, float f1) {
|
||||||
|
this.e = entity.locX;
|
||||||
|
if (entity instanceof EntityLiving) {
|
||||||
|
this.f = entity.locY + entity.getHeadHeight();
|
||||||
|
} else {
|
||||||
|
this.f = (entity.boundingBox.b + entity.boundingBox.e) / 2.0D;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.g = entity.locZ;
|
||||||
|
this.b = f;
|
||||||
|
this.c = f1;
|
||||||
|
this.d = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float a(float f, float f1, float f2) {
|
||||||
|
float f3 = MathHelper.g(f1 - f);
|
||||||
|
|
||||||
|
if (f3 > f2) {
|
||||||
|
f3 = f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f3 < -f2) {
|
||||||
|
f3 = -f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return f + f3;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
package net.citizensnpcs.util.nms;
|
||||||
|
|
||||||
|
import net.citizensnpcs.npc.entity.EntityHumanNPC;
|
||||||
|
import net.citizensnpcs.util.NMS;
|
||||||
|
import net.minecraft.server.v1_6_R1.GenericAttributes;
|
||||||
|
import net.minecraft.server.v1_6_R1.MathHelper;
|
||||||
|
|
||||||
|
public class PlayerControllerMove {
|
||||||
|
private final EntityHumanNPC a;
|
||||||
|
private double b;
|
||||||
|
private double c;
|
||||||
|
private double d;
|
||||||
|
private double e;
|
||||||
|
private boolean f;
|
||||||
|
|
||||||
|
public PlayerControllerMove(EntityHumanNPC entityinsentient) {
|
||||||
|
this.a = entityinsentient;
|
||||||
|
this.b = entityinsentient.locX;
|
||||||
|
this.c = entityinsentient.locY;
|
||||||
|
this.d = entityinsentient.locZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean a() {
|
||||||
|
return this.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void a(double d0, double d1, double d2, double d3) {
|
||||||
|
this.b = d0;
|
||||||
|
this.c = d1;
|
||||||
|
this.d = d2;
|
||||||
|
this.e = d3;
|
||||||
|
this.f = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float a(float f, float f1, float f2) {
|
||||||
|
float f3 = MathHelper.g(f1 - f);
|
||||||
|
|
||||||
|
if (f3 > f2) {
|
||||||
|
f3 = f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f3 < -f2) {
|
||||||
|
f3 = -f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return f + f3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double b() {
|
||||||
|
return this.e;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void c() {
|
||||||
|
this.a.bf = 0F;
|
||||||
|
if (this.f) {
|
||||||
|
this.f = false;
|
||||||
|
int i = MathHelper.floor(this.a.boundingBox.b + 0.5D);
|
||||||
|
double d0 = this.b - this.a.locX;
|
||||||
|
double d1 = this.d - this.a.locZ;
|
||||||
|
double d2 = this.c - i;
|
||||||
|
double d3 = d0 * d0 + d2 * d2 + d1 * d1;
|
||||||
|
|
||||||
|
if (d3 >= 2.500000277905201E-7D) {
|
||||||
|
float f = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||||
|
|
||||||
|
this.a.yaw = this.a(this.a.yaw, f, 30.0F);
|
||||||
|
NMS.setHeadYaw(a, this.a.yaw);
|
||||||
|
float movement = (float) (this.e * this.a.a(GenericAttributes.d).e()) * 10;
|
||||||
|
this.a.i(movement);
|
||||||
|
this.a.bf = movement;
|
||||||
|
if (d2 > 0.0D && d0 * d0 + d1 * d1 < 1.0D) {
|
||||||
|
this.a.getControllerJump().a();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package org.bukkit.craftbukkit.v1_6_R1.entity;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
|
||||||
|
public abstract class CraftEntity implements Entity {
|
||||||
|
public net.minecraft.server.v1_6_R1.Entity getHandle() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,497 @@
|
|||||||
|
package org.bukkit.craftbukkit.v1_6_R1.entity;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_6_R1.EntityLiving;
|
||||||
|
|
||||||
|
import org.bukkit.EntityEffect;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Arrow;
|
||||||
|
import org.bukkit.entity.Egg;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Projectile;
|
||||||
|
import org.bukkit.entity.Snowball;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
|
import org.bukkit.inventory.EntityEquipment;
|
||||||
|
import org.bukkit.metadata.MetadataValue;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.bukkit.util.NumberConversions;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||||
|
@Deprecated
|
||||||
|
public void _INVALID_damage(int amount) {
|
||||||
|
damage(amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public void _INVALID_damage(int amount, Entity source) {
|
||||||
|
damage(amount, source);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public int _INVALID_getHealth() {
|
||||||
|
return NumberConversions.ceil(getHealth());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public int _INVALID_getLastDamage() {
|
||||||
|
return NumberConversions.ceil(getLastDamage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public int _INVALID_getMaxHealth() {
|
||||||
|
return NumberConversions.ceil(getMaxHealth());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public void _INVALID_setHealth(int health) {
|
||||||
|
setHealth(health);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public void _INVALID_setLastDamage(int damage) {
|
||||||
|
setLastDamage(damage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public void _INVALID_setMaxHealth(int health) {
|
||||||
|
setMaxHealth(health);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean addPotionEffect(PotionEffect effect) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean addPotionEffect(PotionEffect effect, boolean force) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean addPotionEffects(Collection<PotionEffect> effects) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void damage(double amount) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void damage(double amount, Entity source) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public void damage(int arg0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public void damage(int arg0, Entity arg1) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean eject() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Collection<PotionEffect> getActivePotionEffects() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean getCanPickupItems() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getCustomName() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getEntityId() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public EntityEquipment getEquipment() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public double getEyeHeight() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public double getEyeHeight(boolean ignoreSneaking) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Location getEyeLocation() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public float getFallDistance() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getFireTicks() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public EntityLiving getHandle() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public double getHealth() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Player getKiller() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public double getLastDamage() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public EntityDamageEvent getLastDamageCause() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<Block> getLastTwoTargetBlocks(HashSet<Byte> transparent, int maxDistance) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<Block> getLineOfSight(HashSet<Byte> transparent, int maxDistance) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Location getLocation() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Location getLocation(Location loc) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getMaxFireTicks() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public double getMaxHealth() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getMaximumAir() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getMaximumNoDamageTicks() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<MetadataValue> getMetadata(String metadataKey) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<Entity> getNearbyEntities(double x, double y, double z) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getNoDamageTicks() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Entity getPassenger() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getRemainingAir() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean getRemoveWhenFarAway() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Server getServer() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Block getTargetBlock(HashSet<Byte> transparent, int maxDistance) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getTicksLived() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public UUID getUniqueId() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Entity getVehicle() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Vector getVelocity() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public World getWorld() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean hasLineOfSight(Entity other) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean hasMetadata(String metadataKey) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean hasPotionEffect(PotionEffectType type) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isCustomNameVisible() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isDead() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isInsideVehicle() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isOnGround() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isValid() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean leaveVehicle() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void playEffect(EntityEffect type) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void remove() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void removePotionEffect(PotionEffectType type) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void resetMaxHealth() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setCanPickupItems(boolean pickup) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setCustomName(String name) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setCustomNameVisible(boolean flag) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setFallDistance(float distance) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setFireTicks(int ticks) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setHealth(double health) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public void setHealth(int arg0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setLastDamage(double damage) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public void setLastDamage(int arg0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setLastDamageCause(EntityDamageEvent event) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setMaxHealth(double health) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public void setMaxHealth(int arg0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setMaximumAir(int ticks) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setMaximumNoDamageTicks(int ticks) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setNoDamageTicks(int ticks) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean setPassenger(Entity passenger) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setRemainingAir(int ticks) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setRemoveWhenFarAway(boolean remove) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setTicksLived(int value) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setVelocity(Vector velocity) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public Arrow shootArrow() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean teleport(Entity destination) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean teleport(Entity destination, TeleportCause cause) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean teleport(Location location) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean teleport(Location location, TeleportCause cause) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public Egg throwEgg() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public Snowball throwSnowball() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
15
src/main/resources/maps.yml
Normal file
15
src/main/resources/maps.yml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
members:
|
||||||
|
"org/bukkit/entity/Damageable _INVALID_damage (I)V": damage
|
||||||
|
"org/bukkit/entity/Damageable _INVALID_damage (ILorg/bukkit/entity/Entity;)V": damage
|
||||||
|
"org/bukkit/entity/Damageable _INVALID_getHealth ()I": getHealth
|
||||||
|
"org/bukkit/entity/Damageable _INVALID_setHealth (I)V": setHealth
|
||||||
|
"org/bukkit/entity/Damageable _INVALID_getMaxHealth ()I": getMaxHealth
|
||||||
|
"org/bukkit/entity/Damageable _INVALID_setMaxHealth (I)V": setMaxHealth
|
||||||
|
"org/bukkit/entity/LivingEntity _INVALID_getLastDamage ()I": getLastDamage
|
||||||
|
"org/bukkit/entity/LivingEntity _INVALID_setLastDamage (I)V": setLastDamage
|
||||||
|
"org/bukkit/event/entity/EntityDamageEvent _INVALID_getDamage ()I": getDamage
|
||||||
|
"org/bukkit/event/entity/EntityDamageEvent _INVALID_setDamage (I)V": setDamage
|
||||||
|
"org/bukkit/event/vehicle/VehicleDamageEvent _INVALID_getDamage ()I": getDamage
|
||||||
|
"org/bukkit/event/vehicle/VehicleDamageEvent _INVALID_setDamage (I)V": setDamage
|
||||||
|
"org/bukkit/event/entity/EntityRegainHealthEvent _INVALID_getAmount ()I": getAmount
|
||||||
|
"org/bukkit/event/entity/EntityRegainHealthEvent _INVALID_setAmount (I)V": setAmount
|
Loading…
Reference in New Issue
Block a user