mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-29 22:23:59 +01:00
Forgot to remove this
This commit is contained in:
parent
57c96f250a
commit
6dbce01c54
@ -26,25 +26,6 @@ public class SelectionPrompt extends NumericPrompt {
|
|||||||
this.selector = selector;
|
this.selector = selector;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void start(NPCSelector selector, Player player, List<NPC> possible) {
|
|
||||||
final Conversation conversation = new ConversationFactory(CitizensAPI.getPlugin())
|
|
||||||
.withLocalEcho(false).withEscapeSequence("exit").withModality(false)
|
|
||||||
.withFirstPrompt(new SelectionPrompt(selector, possible)).buildConversation(player);
|
|
||||||
conversation.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPromptText(ConversationContext context) {
|
|
||||||
String text = Messaging.tr(Messages.SELECTION_PROMPT);
|
|
||||||
int num = 1;
|
|
||||||
for (NPC npc : choices) {
|
|
||||||
text += "<br> - " + npc.getId() + "(" + num + ")";
|
|
||||||
context.setSessionData(npc.getId(), num);
|
|
||||||
num++;
|
|
||||||
}
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||||
Object num = context.getSessionData(input);
|
Object num = context.getSessionData(input);
|
||||||
@ -64,4 +45,23 @@ public class SelectionPrompt extends NumericPrompt {
|
|||||||
Messaging.sendWithNPC(sender, Setting.SELECTION_MESSAGE.asString(), toSelect);
|
Messaging.sendWithNPC(sender, Setting.SELECTION_MESSAGE.asString(), toSelect);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPromptText(ConversationContext context) {
|
||||||
|
String text = Messaging.tr(Messages.SELECTION_PROMPT);
|
||||||
|
int num = 1;
|
||||||
|
for (NPC npc : choices) {
|
||||||
|
text += "<br> - " + npc.getId() + "(" + num + ")";
|
||||||
|
context.setSessionData(npc.getId(), num);
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void start(NPCSelector selector, Player player, List<NPC> possible) {
|
||||||
|
final Conversation conversation = new ConversationFactory(CitizensAPI.getPlugin())
|
||||||
|
.withLocalEcho(false).withEscapeSequence("exit").withModality(false)
|
||||||
|
.withFirstPrompt(new SelectionPrompt(selector, possible)).buildConversation(player);
|
||||||
|
conversation.begin();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@ import org.bukkit.Location;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class Anchor {
|
public class Anchor {
|
||||||
private final String name;
|
|
||||||
private final Location location;
|
private final Location location;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
public Anchor(String name, Location location) {
|
public Anchor(String name, Location location) {
|
||||||
this.location = location;
|
this.location = location;
|
||||||
@ -30,14 +30,14 @@ public class Anchor {
|
|||||||
isEquals();
|
isEquals();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location getLocation() {
|
public Location getLocation() {
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return new HashCodeBuilder(13, 21).
|
return new HashCodeBuilder(13, 21).
|
||||||
|
@ -126,11 +126,12 @@ public class Messages {
|
|||||||
public static final String SCRIPT_COMPILED = "citizens.commands.script.compiled";
|
public static final String SCRIPT_COMPILED = "citizens.commands.script.compiled";
|
||||||
public static final String SCRIPT_COMPILING = "citizens.commands.script.compiling";
|
public static final String SCRIPT_COMPILING = "citizens.commands.script.compiling";
|
||||||
public static final String SCRIPT_FILE_MISSING = "citizens.commands.script.file-missing";
|
public static final String SCRIPT_FILE_MISSING = "citizens.commands.script.file-missing";
|
||||||
|
public static final String SELECTION_PROMPT = "citizens.editors.selection.start-prompt";
|
||||||
public static final String SHEARED_SET = "citizens.editors.equipment.sheared-set";
|
public static final String SHEARED_SET = "citizens.editors.equipment.sheared-set";
|
||||||
public static final String SHEARED_STOPPED = "citizens.editors.equipment.sheared-stopped";
|
public static final String SHEARED_STOPPED = "citizens.editors.equipment.sheared-stopped";
|
||||||
public static final String SKIPPING_BROKEN_TRAIT = "citizens.notifications.skipping-broken-trait";
|
public static final String SKIPPING_BROKEN_TRAIT = "citizens.notifications.skipping-broken-trait";
|
||||||
public static final String SKIPPING_INVALID_POSE = "citizens.notifications.skipping-invalid-pose";
|
|
||||||
public static final String SKIPPING_INVALID_ANCHOR = "citizens.notifications.skipping-invalid-anchor";
|
public static final String SKIPPING_INVALID_ANCHOR = "citizens.notifications.skipping-invalid-anchor";
|
||||||
|
public static final String SKIPPING_INVALID_POSE = "citizens.notifications.skipping-invalid-pose";
|
||||||
public static final String SPEED_MODIFIER_ABOVE_LIMIT = "citizens.commands.npc.speed.modifier-above-limit";
|
public static final String SPEED_MODIFIER_ABOVE_LIMIT = "citizens.commands.npc.speed.modifier-above-limit";
|
||||||
public static final String SPEED_MODIFIER_SET = "citizens.commands.npc.speed.set";
|
public static final String SPEED_MODIFIER_SET = "citizens.commands.npc.speed.set";
|
||||||
public static final String TELEPORTED_TO_NPC = "citizens.commands.npc.tp.teleported";
|
public static final String TELEPORTED_TO_NPC = "citizens.commands.npc.tp.teleported";
|
||||||
@ -169,5 +170,4 @@ public class Messages {
|
|||||||
public static final String VULNERABLE_STOPPED = "citizens.commands.npc.vulnerable.stopped";
|
public static final String VULNERABLE_STOPPED = "citizens.commands.npc.vulnerable.stopped";
|
||||||
public static final String WAYPOINT_PROVIDER_SET = "citizens.waypoints.set-provider";
|
public static final String WAYPOINT_PROVIDER_SET = "citizens.waypoints.set-provider";
|
||||||
public static final String WRITING_DEFAULT_SETTING = "citizens.settings.writing-default";
|
public static final String WRITING_DEFAULT_SETTING = "citizens.settings.writing-default";
|
||||||
public static final String SELECTION_PROMPT = "citizens.editors.selection.start-prompt";
|
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,9 @@ public class NMS {
|
|||||||
// util class
|
// util class
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final float DEFAULT_SPEED = 0.4F;
|
private static Field DAMAGE_FIELD;
|
||||||
|
|
||||||
|
private static final float DEFAULT_SPEED = 0.4F;
|
||||||
private static Map<Class<? extends Entity>, Integer> ENTITY_CLASS_TO_INT;
|
private static Map<Class<? extends Entity>, Integer> ENTITY_CLASS_TO_INT;
|
||||||
private static final Map<Class<? extends Entity>, Constructor<? extends Entity>> ENTITY_CONSTRUCTOR_CACHE = new WeakHashMap<Class<? extends Entity>, Constructor<? extends Entity>>();
|
private static final Map<Class<? extends Entity>, Constructor<? extends Entity>> ENTITY_CONSTRUCTOR_CACHE = new WeakHashMap<Class<? extends Entity>, Constructor<? extends Entity>>();
|
||||||
private static Map<Integer, Class<? extends Entity>> ENTITY_INT_TO_CLASS;
|
private static Map<Integer, Class<? extends Entity>> ENTITY_INT_TO_CLASS;
|
||||||
@ -45,10 +46,8 @@ public class NMS {
|
|||||||
private static Field PATHFINDING_RANGE;
|
private static Field PATHFINDING_RANGE;
|
||||||
private static Field SPEED_FIELD;
|
private static Field SPEED_FIELD;
|
||||||
private static Field THREAD_STOPPER;
|
private static Field THREAD_STOPPER;
|
||||||
private static Field DAMAGE_FIELD;
|
|
||||||
|
|
||||||
public static void attack(EntityLiving handle, EntityLiving target) {
|
public static void attack(EntityLiving handle, EntityLiving target) {
|
||||||
handle.k(target);
|
|
||||||
int damage = getDamage(handle);
|
int damage = getDamage(handle);
|
||||||
|
|
||||||
if (handle.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
|
if (handle.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
|
||||||
@ -62,16 +61,6 @@ public class NMS {
|
|||||||
target.damageEntity(DamageSource.mobAttack(handle), damage);
|
target.damageEntity(DamageSource.mobAttack(handle), damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getDamage(EntityLiving handle) {
|
|
||||||
if (DAMAGE_FIELD == null)
|
|
||||||
return 2;
|
|
||||||
try {
|
|
||||||
return DAMAGE_FIELD.getInt(handle);
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void clearGoals(PathfinderGoalSelector... goalSelectors) {
|
public static void clearGoals(PathfinderGoalSelector... goalSelectors) {
|
||||||
if (NMS.GOAL_FIELD == null || goalSelectors == null)
|
if (NMS.GOAL_FIELD == null || goalSelectors == null)
|
||||||
return;
|
return;
|
||||||
@ -97,6 +86,16 @@ public class NMS {
|
|||||||
return constructor;
|
return constructor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int getDamage(EntityLiving handle) {
|
||||||
|
if (DAMAGE_FIELD == null)
|
||||||
|
return 2;
|
||||||
|
try {
|
||||||
|
return DAMAGE_FIELD.getInt(handle);
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
private static Field getField(Class<?> clazz, String field) {
|
private static Field getField(Class<?> clazz, String field) {
|
||||||
Field f = null;
|
Field f = null;
|
||||||
try {
|
try {
|
||||||
@ -193,6 +192,11 @@ public class NMS {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void trySwim(EntityLiving handle) {
|
||||||
|
if ((handle.H() || handle.J()) && Math.random() < 0.8F)
|
||||||
|
handle.motY += 0.04;
|
||||||
|
}
|
||||||
|
|
||||||
public static void updateAI(EntityLiving entity) {
|
public static void updateAI(EntityLiving entity) {
|
||||||
entity.getNavigation().e();
|
entity.getNavigation().e();
|
||||||
entity.getControllerMove().c();
|
entity.getControllerMove().c();
|
||||||
@ -256,9 +260,4 @@ public class NMS {
|
|||||||
Messaging.logTr(Messages.ERROR_GETTING_ID_MAPPING, e.getMessage());
|
Messaging.logTr(Messages.ERROR_GETTING_ID_MAPPING, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void trySwim(EntityLiving handle) {
|
|
||||||
if ((handle.H() || handle.J()) && Math.random() < 0.8F)
|
|
||||||
handle.motY += 0.04;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user