mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 03:25:02 +00:00
More Core Class Conversion
This commit is contained in:
1 parent
27a9e4c808
commit
79b63efa19
36 files changed
+420
-102
No files matched your search
@@ -0,0 +1,9 @@
|
||||
package kamkeel.npcs.controllers.data.ability.enums;
|
||||
|
||||
public enum AbilityPhase {
|
||||
IDLE, // Not executing
|
||||
WINDUP, // Charging up (telegraph visible)
|
||||
ACTIVE, // Executing (damage happens)
|
||||
DAZED, // Stunned after interrupt during WINDUP (cannot attack)
|
||||
BURST_DELAY // Waiting between burst repetitions (free movement/rotation)
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package kamkeel.npcs.controllers.data.ability.enums;
|
||||
|
||||
/**
|
||||
* Defines anchor points for ability charging effects.
|
||||
* Determines where the charging visual (orb, disc, etc.) appears relative to the entity.
|
||||
*/
|
||||
public enum AnchorPoint {
|
||||
FRONT("Front"), // In front of entity face (default)
|
||||
CENTER("Center"), // Entity center
|
||||
RIGHT_HAND("Right Hand"), // Right arm/hand position
|
||||
LEFT_HAND("Left Hand"), // Left arm/hand position
|
||||
ABOVE_HEAD("Above Head"), // Above the entity
|
||||
CHEST("Chest"), // Chest level, centered
|
||||
EYE("Eye"); // Eye level, centered
|
||||
|
||||
private final String displayName;
|
||||
|
||||
AnchorPoint(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get AnchorPoint from ordinal value.
|
||||
* Returns FRONT if ordinal is out of bounds.
|
||||
*/
|
||||
public static AnchorPoint fromOrdinal(int ordinal) {
|
||||
AnchorPoint[] vals = values();
|
||||
if (ordinal < 0 || ordinal >= vals.length) {
|
||||
return FRONT;
|
||||
}
|
||||
return vals[ordinal];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all display names for GUI dropdowns.
|
||||
*/
|
||||
public static String[] getDisplayNames() {
|
||||
AnchorPoint[] values = values();
|
||||
String[] names = new String[values.length];
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
names[i] = values[i].displayName;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
switch (this) {
|
||||
case FRONT:
|
||||
return "ability.anchor.front";
|
||||
case CENTER:
|
||||
return "ability.anchor.center";
|
||||
case RIGHT_HAND:
|
||||
return "ability.anchor.rightHand";
|
||||
case LEFT_HAND:
|
||||
return "ability.anchor.leftHand";
|
||||
case ABOVE_HEAD:
|
||||
return "ability.anchor.aboveHead";
|
||||
case CHEST:
|
||||
return "ability.anchor.chest";
|
||||
case EYE:
|
||||
return "ability.anchor.eye";
|
||||
default:
|
||||
return name();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package kamkeel.npcs.controllers.data.ability.enums;
|
||||
|
||||
/**
|
||||
* Shared hit behavior for energy projectiles.
|
||||
*/
|
||||
public enum HitType {
|
||||
SINGLE,
|
||||
PIERCE,
|
||||
MULTI;
|
||||
|
||||
public static HitType fromOrdinal(int ordinal) {
|
||||
HitType[] values = values();
|
||||
if (ordinal >= 0 && ordinal < values.length) {
|
||||
return values[ordinal];
|
||||
}
|
||||
return SINGLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
switch (this) {
|
||||
case SINGLE:
|
||||
return "ability.hitType.single";
|
||||
case PIERCE:
|
||||
return "ability.hitType.pierce";
|
||||
case MULTI:
|
||||
return "ability.hitType.multi";
|
||||
default:
|
||||
return name();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package kamkeel.npcs.controllers.data.ability.enums;
|
||||
|
||||
/**
|
||||
* Defines when a caster is invulnerable while an ability is executing.
|
||||
*/
|
||||
public enum InvulnerableMode {
|
||||
NONE,
|
||||
WINDUP,
|
||||
ACTIVE,
|
||||
BOTH;
|
||||
|
||||
public boolean invulnerableDuringWindup() {
|
||||
return this == WINDUP || this == BOTH;
|
||||
}
|
||||
|
||||
public boolean invulnerableDuringActive() {
|
||||
return this == ACTIVE || this == BOTH;
|
||||
}
|
||||
|
||||
/**
|
||||
* Treat BURST_DELAY as windup-like for interruption/damage immunity checks.
|
||||
*/
|
||||
public boolean isInvulnerableInPhase(AbilityPhase phase) {
|
||||
if (phase == null) return false;
|
||||
switch (phase) {
|
||||
case WINDUP:
|
||||
case BURST_DELAY:
|
||||
return invulnerableDuringWindup();
|
||||
case ACTIVE:
|
||||
return invulnerableDuringActive();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String getDisplayKey() {
|
||||
switch (this) {
|
||||
case WINDUP:
|
||||
return "ability.invulnerable.windup";
|
||||
case ACTIVE:
|
||||
return "ability.invulnerable.active";
|
||||
case BOTH:
|
||||
return "ability.invulnerable.both";
|
||||
case NONE:
|
||||
default:
|
||||
return "ability.invulnerable.none";
|
||||
}
|
||||
}
|
||||
|
||||
public static String[] getDisplayKeys() {
|
||||
return new String[]{
|
||||
"ability.invulnerable.none",
|
||||
"ability.invulnerable.windup",
|
||||
"ability.invulnerable.active",
|
||||
"ability.invulnerable.both"
|
||||
};
|
||||
}
|
||||
|
||||
public static InvulnerableMode fromOrdinal(int ordinal) {
|
||||
InvulnerableMode[] values = values();
|
||||
if (ordinal >= 0 && ordinal < values.length) {
|
||||
return values[ordinal];
|
||||
}
|
||||
return NONE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package kamkeel.npcs.controllers.data.ability.enums;
|
||||
|
||||
/**
|
||||
* Defines when an ability locks NPC movement and rotation.
|
||||
*/
|
||||
public enum LockMode {
|
||||
/**
|
||||
* No movement lock - NPC can move freely during both phases.
|
||||
*/
|
||||
NO,
|
||||
|
||||
/**
|
||||
* Lock movement during WINDUP phase only.
|
||||
* NPC can move during ACTIVE phase.
|
||||
*/
|
||||
WINDUP,
|
||||
|
||||
/**
|
||||
* Lock movement during ACTIVE phase only.
|
||||
* NPC can move during WINDUP phase.
|
||||
*/
|
||||
ACTIVE,
|
||||
|
||||
/**
|
||||
* Lock movement during both WINDUP and ACTIVE phases.
|
||||
*/
|
||||
WINDUP_AND_ACTIVE;
|
||||
|
||||
/**
|
||||
* Check if movement should be locked during WINDUP phase.
|
||||
*/
|
||||
public boolean locksWindup() {
|
||||
return this == WINDUP || this == WINDUP_AND_ACTIVE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if movement should be locked during ACTIVE phase.
|
||||
*/
|
||||
public boolean locksActive() {
|
||||
return this == ACTIVE || this == WINDUP_AND_ACTIVE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get display name for GUI.
|
||||
*/
|
||||
public String getDisplayKey() {
|
||||
switch (this) {
|
||||
case NO:
|
||||
return "gui.no";
|
||||
case WINDUP:
|
||||
return "ability.lockMove.windup";
|
||||
case ACTIVE:
|
||||
return "ability.lockMove.active";
|
||||
case WINDUP_AND_ACTIVE:
|
||||
return "ability.lockMove.both";
|
||||
default:
|
||||
return "gui.no";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all display keys for GUI dropdown.
|
||||
*/
|
||||
public static String[] getDisplayKeys() {
|
||||
return new String[]{
|
||||
"gui.no",
|
||||
"ability.lockMove.windup",
|
||||
"ability.lockMove.active",
|
||||
"ability.lockMove.both"
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get LockMode from ordinal, with fallback to WINDUP.
|
||||
*/
|
||||
public static LockMode fromOrdinal(int ordinal) {
|
||||
LockMode[] values = values();
|
||||
if (ordinal >= 0 && ordinal < values.length) {
|
||||
return values[ordinal];
|
||||
}
|
||||
return WINDUP;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package kamkeel.npcs.controllers.data.ability.enums;
|
||||
|
||||
/**
|
||||
* Defines what happens to NPC rotation during ability phases.
|
||||
* Used with a LockMode to control WHEN it applies.
|
||||
*/
|
||||
public enum RotationMode {
|
||||
/**
|
||||
* NPC rotates normally via AI look helper.
|
||||
*/
|
||||
FREE,
|
||||
|
||||
/**
|
||||
* Freeze rotation at the moment the phase starts.
|
||||
* NPC stays facing the direction it was looking when the phase began.
|
||||
*/
|
||||
LOCKED,
|
||||
|
||||
/**
|
||||
* Force NPC to continuously face its target (hit scan).
|
||||
* Overrides AI look helper every tick for precise aiming.
|
||||
*/
|
||||
TRACK;
|
||||
|
||||
public String getDisplayKey() {
|
||||
switch (this) {
|
||||
case FREE:
|
||||
return "ability.rotation.free";
|
||||
case LOCKED:
|
||||
return "ability.rotation.locked";
|
||||
case TRACK:
|
||||
return "ability.rotation.track";
|
||||
default:
|
||||
return "ability.rotation.free";
|
||||
}
|
||||
}
|
||||
|
||||
public static String[] getDisplayKeys() {
|
||||
return new String[]{
|
||||
"ability.rotation.free",
|
||||
"ability.rotation.locked",
|
||||
"ability.rotation.track"
|
||||
};
|
||||
}
|
||||
|
||||
public static RotationMode fromOrdinal(int ordinal) {
|
||||
RotationMode[] values = values();
|
||||
if (ordinal >= 0 && ordinal < values.length) {
|
||||
return values[ordinal];
|
||||
}
|
||||
return FREE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package kamkeel.npcs.controllers.data.ability.enums;
|
||||
|
||||
/**
|
||||
* Filter for determining which entities an ability should affect in AOE mode.
|
||||
*/
|
||||
public enum TargetFilter {
|
||||
ALLIES,
|
||||
ENEMIES,
|
||||
ALL;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
switch (this) {
|
||||
case ALLIES:
|
||||
return "ability.targetFilter.allies";
|
||||
case ENEMIES:
|
||||
return "ability.targetFilter.enemies";
|
||||
case ALL:
|
||||
return "ability.targetFilter.all";
|
||||
default:
|
||||
return name();
|
||||
}
|
||||
}
|
||||
|
||||
public static TargetFilter fromString(String name) {
|
||||
try {
|
||||
return valueOf(name);
|
||||
} catch (Exception e) {
|
||||
return ALLIES;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package kamkeel.npcs.controllers.data.ability.enums;
|
||||
|
||||
/**
|
||||
* Defines how an ability selects its target(s).
|
||||
*/
|
||||
public enum TargetingMode {
|
||||
/**
|
||||
* Target the current aggro target
|
||||
*/
|
||||
AGGRO_TARGET,
|
||||
|
||||
/**
|
||||
* Target self (for buffs, heals, guards)
|
||||
*/
|
||||
SELF,
|
||||
|
||||
/**
|
||||
* AOE centered on self
|
||||
*/
|
||||
AOE_SELF,
|
||||
|
||||
/**
|
||||
* AOE centered on target
|
||||
*/
|
||||
AOE_TARGET;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
switch (this) {
|
||||
case AGGRO_TARGET:
|
||||
return "ability.target.aggro_target";
|
||||
case SELF:
|
||||
return "ability.target.self";
|
||||
case AOE_SELF:
|
||||
return "ability.target.aoe_self";
|
||||
case AOE_TARGET:
|
||||
return "ability.target.aoe_target";
|
||||
default:
|
||||
return name();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package kamkeel.npcs.controllers.data.ability.enums;
|
||||
|
||||
/**
|
||||
* Defines which entity types can use an ability.
|
||||
*/
|
||||
public enum UserType {
|
||||
NPC_ONLY,
|
||||
PLAYER_ONLY,
|
||||
BOTH,
|
||||
NONE;
|
||||
|
||||
public boolean allowsNpc() {
|
||||
return this == NPC_ONLY || this == BOTH;
|
||||
}
|
||||
|
||||
public boolean allowsPlayer() {
|
||||
return this == PLAYER_ONLY || this == BOTH;
|
||||
}
|
||||
|
||||
public static UserType fromOrdinal(int ordinal) {
|
||||
UserType[] values = values();
|
||||
if (ordinal >= 0 && ordinal < values.length) {
|
||||
return values[ordinal];
|
||||
}
|
||||
return BOTH;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package kamkeel.npcs.controllers.data.attribute;
|
||||
|
||||
import noppes.npcs.api.handler.data.IAttributeDefinition;
|
||||
|
||||
public class AttributeDefinition implements IAttributeDefinition {
|
||||
private final String key;
|
||||
private String translationKey;// e.g., "main_attack_flat"
|
||||
private final String displayName; // Human‑readable name
|
||||
private final char colorCode;
|
||||
private final AttributeValueType attributeValueType;
|
||||
private final AttributeSection section;
|
||||
|
||||
public AttributeDefinition(String key, String displayName, char colorCode, AttributeValueType attributeValueType, AttributeSection section) {
|
||||
this.key = key;
|
||||
this.translationKey = "rpgcore:attribute." + key;
|
||||
this.displayName = displayName;
|
||||
this.attributeValueType = attributeValueType;
|
||||
this.section = section;
|
||||
this.colorCode = colorCode;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public String getTranslationKey() {
|
||||
return translationKey;
|
||||
}
|
||||
|
||||
public void setTranslationKey(String translationKey) {
|
||||
this.translationKey = translationKey;
|
||||
}
|
||||
|
||||
public AttributeValueType getValueType() {
|
||||
return attributeValueType;
|
||||
}
|
||||
|
||||
public AttributeSection getSection() {
|
||||
return section;
|
||||
}
|
||||
|
||||
public char getColorCode() {
|
||||
return colorCode;
|
||||
}
|
||||
|
||||
public enum AttributeSection {
|
||||
BASE,
|
||||
MODIFIER,
|
||||
STATS,
|
||||
INFO,
|
||||
EXTRA
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package kamkeel.npcs.controllers.data.attribute;
|
||||
|
||||
public enum AttributeValueType {
|
||||
FLAT, // e.g., +10 Health or +3 Damage
|
||||
PERCENT, // e.g., +0.25 means +25% bonus
|
||||
MAGIC // Represents a container of magic–based values (summed up as a float)
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package kamkeel.npcs.controllers.data.attribute;
|
||||
|
||||
|
||||
import noppes.npcs.api.handler.data.ICustomAttribute;
|
||||
|
||||
public class PlayerAttribute implements ICustomAttribute {
|
||||
private final AttributeDefinition attribute;
|
||||
public float value;
|
||||
|
||||
public PlayerAttribute(AttributeDefinition attribute, float value) {
|
||||
this.attribute = attribute;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttributeDefinition getAttribute() {
|
||||
return attribute;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package kamkeel.npcs.controllers.data.attribute;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* CustomAttributeMap holds a set of attribute instances for an entity (or item).
|
||||
*/
|
||||
public class PlayerAttributeMap {
|
||||
public final Map<AttributeDefinition, PlayerAttribute> map = new HashMap<>();
|
||||
|
||||
public PlayerAttribute registerAttribute(AttributeDefinition attribute, float baseValue) {
|
||||
if (map.containsKey(attribute)) {
|
||||
throw new IllegalArgumentException("Attribute already registered: " + attribute.getKey());
|
||||
}
|
||||
PlayerAttribute instance = new PlayerAttribute(attribute, baseValue);
|
||||
map.put(attribute, instance);
|
||||
return instance;
|
||||
}
|
||||
|
||||
public PlayerAttribute getAttributeInstance(AttributeDefinition attribute) {
|
||||
return map.get(attribute);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package kamkeel.npcs.controllers.data.profile;
|
||||
|
||||
public enum EnumProfileOperation {
|
||||
SUCCESS,
|
||||
ERROR,
|
||||
LOCKED
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package kamkeel.npcs.controllers.data.profile;
|
||||
|
||||
import noppes.npcs.platform.nbt.INBTCompound;
|
||||
import noppes.npcs.core.NBT;
|
||||
|
||||
public class ProfileInfoEntry {
|
||||
private String label;
|
||||
private String result;
|
||||
private int labelColor;
|
||||
private int resultColor;
|
||||
|
||||
public ProfileInfoEntry() {
|
||||
}
|
||||
|
||||
public ProfileInfoEntry(String label, int labelColor, String result, int resultColor) {
|
||||
this.label = label;
|
||||
this.result = result;
|
||||
this.labelColor = labelColor;
|
||||
this.resultColor = resultColor;
|
||||
}
|
||||
|
||||
public ProfileInfoEntry(String label, int labelColor, int result, int resultColor) {
|
||||
this(label, labelColor, String.valueOf(result), resultColor);
|
||||
}
|
||||
|
||||
public ProfileInfoEntry(String label, String result) {
|
||||
this(label, 0xFFFFFF, result, 0xFFFFFF);
|
||||
}
|
||||
|
||||
public INBTCompound writeToNBT() {
|
||||
INBTCompound tag = NBT.compound();
|
||||
tag.setString("Label", label);
|
||||
tag.setInteger("LabelColor", labelColor);
|
||||
tag.setString("Result", result);
|
||||
tag.setInteger("ResultColor", resultColor);
|
||||
return tag;
|
||||
}
|
||||
|
||||
public static ProfileInfoEntry readFromNBT(INBTCompound tag) {
|
||||
return new ProfileInfoEntry(
|
||||
tag.getString("Label"),
|
||||
tag.getInteger("LabelColor"),
|
||||
tag.getString("Result"),
|
||||
tag.getInteger("ResultColor")
|
||||
);
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public int getLabelColor() {
|
||||
return labelColor;
|
||||
}
|
||||
|
||||
public int getResultColor() {
|
||||
return resultColor;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package kamkeel.npcs.controllers.data.telegraph;
|
||||
|
||||
/**
|
||||
* Types of telegraph shapes for visual attack warnings.
|
||||
*/
|
||||
public enum TelegraphType {
|
||||
/**
|
||||
* Filled circle (uses radius)
|
||||
*/
|
||||
CIRCLE,
|
||||
|
||||
/**
|
||||
* Donut shape (uses radius and innerRadius)
|
||||
*/
|
||||
RING,
|
||||
|
||||
/**
|
||||
* Rectangle (uses length, width)
|
||||
*/
|
||||
LINE,
|
||||
|
||||
/**
|
||||
* Fan/wedge shape (uses length, angle)
|
||||
*/
|
||||
CONE,
|
||||
|
||||
/**
|
||||
* Single point indicator
|
||||
*/
|
||||
POINT,
|
||||
|
||||
/**
|
||||
* Filled square (uses radius as half-size)
|
||||
*/
|
||||
SQUARE,
|
||||
|
||||
/**
|
||||
* No telegraph
|
||||
*/
|
||||
NONE
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package kamkeel.npcs.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Utility helpers for filename-safe ability/chained names.
|
||||
* Allowed characters are letters, digits, underscore, and dash.
|
||||
*/
|
||||
public final class FileNameHelper {
|
||||
|
||||
private static final Set<String> WINDOWS_RESERVED_NAMES = new HashSet<String>(Arrays.asList(
|
||||
"CON", "PRN", "AUX", "NUL",
|
||||
"COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9",
|
||||
"LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"
|
||||
));
|
||||
|
||||
private FileNameHelper() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize a name to a filename-safe identifier.
|
||||
* Whitespace becomes underscores; unsupported chars are removed.
|
||||
*/
|
||||
public static String sanitizeName(String input, String fallback) {
|
||||
String sanitized = sanitizeInternal(input);
|
||||
if (sanitized.isEmpty()) {
|
||||
sanitized = sanitizeInternal(fallback);
|
||||
}
|
||||
if (sanitized.isEmpty()) {
|
||||
sanitized = "Ability";
|
||||
}
|
||||
if (isReservedWindowsName(sanitized)) {
|
||||
sanitized = "_" + sanitized;
|
||||
}
|
||||
return sanitized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize textfield input without forcing a fallback.
|
||||
*/
|
||||
public static String sanitizeTextInput(String input) {
|
||||
return sanitizeInternal(input);
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick check for compatibility with sanitized identifier rules.
|
||||
*/
|
||||
public static boolean isFileNameCompatible(String value) {
|
||||
if (value == null || value.isEmpty()) return false;
|
||||
if (isReservedWindowsName(value)) return false;
|
||||
for (int i = 0; i < value.length(); i++) {
|
||||
char c = value.charAt(i);
|
||||
if (!Character.isLetterOrDigit(c) && c != '_' && c != '-') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Human-readable fallback display text for sanitized names.
|
||||
*/
|
||||
public static String toDisplayName(String value) {
|
||||
if (value == null || value.isEmpty()) return "";
|
||||
return value.replace('_', ' ');
|
||||
}
|
||||
|
||||
private static String sanitizeInternal(String raw) {
|
||||
if (raw == null) return "";
|
||||
String trimmed = raw.trim();
|
||||
if (trimmed.isEmpty()) return "";
|
||||
|
||||
StringBuilder out = new StringBuilder(trimmed.length());
|
||||
|
||||
for (int i = 0; i < trimmed.length(); i++) {
|
||||
char c = trimmed.charAt(i);
|
||||
if (Character.isLetterOrDigit(c)) {
|
||||
out.append(c);
|
||||
} else if (c == '_' || c == '-') {
|
||||
out.append(c);
|
||||
} else if (Character.isWhitespace(c)) {
|
||||
if (out.length() == 0) continue;
|
||||
char last = out.charAt(out.length() - 1);
|
||||
if (last == '_') continue;
|
||||
out.append('_');
|
||||
}
|
||||
}
|
||||
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
private static boolean isReservedWindowsName(String value) {
|
||||
return WINDOWS_RESERVED_NAMES.contains(value.toUpperCase());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package kamkeel.npcs.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TextSplitter {
|
||||
public static List<String> splitText(String input, int maxSegmentLength) {
|
||||
List<String> result = new ArrayList<>();
|
||||
|
||||
while (input.length() > maxSegmentLength) {
|
||||
int spaceIndex = input.lastIndexOf(" ", maxSegmentLength);
|
||||
if (spaceIndex == -1) {
|
||||
// No space found within the maxSegmentLength, so split at the exact length.
|
||||
result.add(input.substring(0, maxSegmentLength));
|
||||
input = input.substring(maxSegmentLength);
|
||||
} else {
|
||||
// Split at the last space within maxSegmentLength.
|
||||
result.add(input.substring(0, spaceIndex));
|
||||
input = input.substring(spaceIndex + 1); // Skip the space.
|
||||
}
|
||||
}
|
||||
|
||||
if (!input.isEmpty()) {
|
||||
result.add(input);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String longText = "This is a very long string that needs to be split into multiple lines based on a maximum line length of 30 characters.";
|
||||
int maxLineLength = 30;
|
||||
|
||||
List<String> lines = splitText(longText, maxLineLength);
|
||||
|
||||
for (String line : lines) {
|
||||
System.out.println(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import noppes.npcs.api.handler.data.IFrame;
|
||||
import noppes.npcs.api.handler.data.IFramePart;
|
||||
import noppes.npcs.constants.EnumAnimationPart;
|
||||
import noppes.npcs.platform.nbt.INBTCompound;
|
||||
import noppes.npcs.platform.nbt.INBTList;
|
||||
import noppes.npcs.core.NBT;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class Frame implements IFrame {
|
||||
public float parentSpeed = 1.0f;
|
||||
public byte parentSmooth = 0;
|
||||
|
||||
public HashMap<EnumAnimationPart, FramePart> frameParts = new HashMap<>();
|
||||
public int duration = 0;
|
||||
|
||||
boolean customized = false;
|
||||
public float speed = 1.0F;
|
||||
public byte smooth = 0;
|
||||
|
||||
private int colorMarker = 0xFFFFFF;
|
||||
private String comment = "";
|
||||
|
||||
public Frame() {
|
||||
}
|
||||
|
||||
public Frame(int duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public Frame(int duration, float speed, byte smooth) {
|
||||
this.duration = duration;
|
||||
this.speed = speed;
|
||||
this.smooth = smooth;
|
||||
this.customized = true;
|
||||
}
|
||||
|
||||
public HashMap<EnumAnimationPart, FramePart> getFrameMap() {
|
||||
return frameParts;
|
||||
}
|
||||
|
||||
public IFramePart[] getParts() {
|
||||
return frameParts.values().toArray(new IFramePart[0]);
|
||||
}
|
||||
|
||||
public IFrame addPart(IFramePart partConfig) {
|
||||
this.frameParts.put(((FramePart) partConfig).getPart(), (FramePart) partConfig);
|
||||
return this;
|
||||
}
|
||||
|
||||
public IFrame removePart(String partName) {
|
||||
try {
|
||||
this.frameParts.remove(EnumAnimationPart.valueOf(partName));
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public IFrame removePart(int partId) {
|
||||
for (EnumAnimationPart part : EnumAnimationPart.values()) {
|
||||
this.frameParts.remove(part);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public IFrame clearParts() {
|
||||
frameParts.clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public IFrame setDuration(int duration) {
|
||||
this.duration = duration;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isCustomized() {
|
||||
return customized;
|
||||
}
|
||||
|
||||
public IFrame setCustomized(boolean customized) {
|
||||
this.customized = customized;
|
||||
return this;
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public IFrame setSpeed(float speed) {
|
||||
this.speed = speed;
|
||||
return this;
|
||||
}
|
||||
|
||||
public byte smoothType() {
|
||||
return smooth;
|
||||
}
|
||||
|
||||
public IFrame setSmooth(byte smooth) {
|
||||
this.smooth = smooth;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getColorMarker() {
|
||||
return this.colorMarker;
|
||||
}
|
||||
|
||||
public void setColorMarker(int color) {
|
||||
this.colorMarker = color;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return this.comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public void readFromNBT(INBTCompound compound) {
|
||||
duration = compound.getInteger("Duration");
|
||||
if (compound.hasKey("ColorMarker")) {
|
||||
this.setColorMarker(compound.getInteger("ColorMarker"));
|
||||
}
|
||||
if (compound.hasKey("Comment")) {
|
||||
this.comment = compound.getString("Comment");
|
||||
}
|
||||
|
||||
// Customized = TRUE if Speed or Smooth Exist
|
||||
if (compound.hasKey("Speed")) {
|
||||
customized = true;
|
||||
speed = compound.getFloat("Speed");
|
||||
}
|
||||
if (compound.hasKey("Smooth")) {
|
||||
customized = true;
|
||||
smooth = compound.getByte("Smooth");
|
||||
}
|
||||
|
||||
if (!customized) {
|
||||
this.speed = parentSpeed;
|
||||
this.smooth = parentSmooth;
|
||||
}
|
||||
|
||||
HashMap<EnumAnimationPart, FramePart> frameParts = new HashMap<>();
|
||||
INBTList list = compound.getList("FrameParts", 10);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
INBTCompound item = list.getCompound(i);
|
||||
FramePart framePart = new FramePart();
|
||||
framePart.readFromNBT(item);
|
||||
if (!framePart.customized) {
|
||||
framePart.smooth = this.smooth;
|
||||
framePart.speed = this.speed;
|
||||
}
|
||||
frameParts.put(framePart.part, framePart);
|
||||
}
|
||||
this.frameParts = frameParts;
|
||||
}
|
||||
|
||||
public INBTCompound writeToNBT() {
|
||||
INBTCompound compound = NBT.compound();
|
||||
compound.setInteger("Duration", duration);
|
||||
compound.setInteger("ColorMarker", this.colorMarker);
|
||||
compound.setString("Comment", this.comment);
|
||||
|
||||
if (customized) {
|
||||
compound.setFloat("Speed", speed);
|
||||
compound.setByte("Smooth", smooth);
|
||||
}
|
||||
|
||||
INBTList list = NBT.list();
|
||||
for (FramePart framePart : frameParts.values()) {
|
||||
INBTCompound item = framePart.writeToNBT();
|
||||
list.addCompound(item);
|
||||
}
|
||||
compound.setList("FrameParts", list);
|
||||
return compound;
|
||||
}
|
||||
|
||||
public Frame copy() {
|
||||
Frame frame = new Frame(this.duration);
|
||||
HashMap<EnumAnimationPart, FramePart> frameParts = this.frameParts;
|
||||
for (Map.Entry<EnumAnimationPart, FramePart> entry : frameParts.entrySet()) {
|
||||
frame.frameParts.put(entry.getKey(), entry.getValue().copy());
|
||||
}
|
||||
frame.parentSpeed = this.parentSpeed;
|
||||
frame.parentSmooth = this.parentSmooth;
|
||||
frame.duration = this.duration;
|
||||
frame.customized = this.customized;
|
||||
frame.speed = this.speed;
|
||||
frame.smooth = this.smooth;
|
||||
frame.colorMarker = this.colorMarker;
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import noppes.npcs.api.handler.data.IFramePart;
|
||||
import noppes.npcs.constants.EnumAnimationPart;
|
||||
import noppes.npcs.platform.nbt.INBTCompound;
|
||||
import noppes.npcs.core.NBT;
|
||||
|
||||
public class FramePart implements IFramePart {
|
||||
public boolean paused = false;
|
||||
public static float renderPartialTick = 0;
|
||||
|
||||
public EnumAnimationPart part;
|
||||
public float[] rotation = {0, 0, 0};
|
||||
public float[] pivot = {0, 0, 0};
|
||||
|
||||
boolean customized = false;
|
||||
|
||||
public float speed = 1.0F;
|
||||
//0 - Interpolated, 1 - Linear, 2 - None
|
||||
public byte smooth = 0;
|
||||
|
||||
//Client-sided fields (unsaved)
|
||||
public float[] prevRotations = {0, 0, 0};
|
||||
public float[] prevPivots = {0, 0, 0};
|
||||
public float partialRotationTick;
|
||||
public float partialPivotTick;
|
||||
|
||||
public FramePart() {
|
||||
}
|
||||
|
||||
public FramePart(EnumAnimationPart part) {
|
||||
this.part = part;
|
||||
}
|
||||
|
||||
public EnumAnimationPart getPart() {
|
||||
return part;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return part.name();
|
||||
}
|
||||
|
||||
public int getPartId() {
|
||||
return part.ordinal();
|
||||
}
|
||||
|
||||
public void setPart(EnumAnimationPart part) {
|
||||
this.part = part;
|
||||
}
|
||||
|
||||
public IFramePart setPart(String name) {
|
||||
try {
|
||||
this.setPart(EnumAnimationPart.valueOf(name));
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public IFramePart setPart(int partId) {
|
||||
for (EnumAnimationPart enumPart : EnumAnimationPart.values()) {
|
||||
if (enumPart.ordinal() == partId) {
|
||||
this.setPart(enumPart);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public float[] getRotations() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
public IFramePart setRotations(float[] rotation) {
|
||||
this.rotation = rotation;
|
||||
return this;
|
||||
}
|
||||
|
||||
public float[] getPivots() {
|
||||
return pivot;
|
||||
}
|
||||
|
||||
public IFramePart setPivots(float[] pivot) {
|
||||
this.pivot = pivot;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isCustomized() {
|
||||
return customized;
|
||||
}
|
||||
|
||||
public IFramePart setCustomized(boolean customized) {
|
||||
this.customized = customized;
|
||||
return this;
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public IFramePart setSpeed(float speed) {
|
||||
this.speed = speed;
|
||||
return this;
|
||||
}
|
||||
|
||||
public byte isSmooth() {
|
||||
return smooth;
|
||||
}
|
||||
|
||||
public IFramePart setSmooth(byte smooth) {
|
||||
this.smooth = smooth;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void readFromNBT(INBTCompound compound) {
|
||||
part = EnumAnimationPart.valueOf(compound.getString("Part"));
|
||||
for (int i = 0; i < 3; i++) {
|
||||
rotation[i] = compound.getFloat("Rotation" + i);
|
||||
}
|
||||
for (int i = 0; i < 3; i++) {
|
||||
pivot[i] = compound.getFloat("Pivot" + i);
|
||||
}
|
||||
|
||||
// Customized = TRUE if Speed or Smooth Exist
|
||||
if (compound.hasKey("Speed")) {
|
||||
customized = true;
|
||||
speed = compound.getFloat("Speed");
|
||||
}
|
||||
if (compound.hasKey("Smooth")) {
|
||||
customized = true;
|
||||
smooth = compound.getByte("Smooth");
|
||||
}
|
||||
}
|
||||
|
||||
public INBTCompound writeToNBT() {
|
||||
INBTCompound compound = NBT.compound();
|
||||
compound.setString("Part", part.toString());
|
||||
for (int i = 0; i < 3; i++) {
|
||||
compound.setFloat("Rotation" + i, rotation[i]);
|
||||
}
|
||||
for (int i = 0; i < 3; i++) {
|
||||
compound.setFloat("Pivot" + i, pivot[i]);
|
||||
}
|
||||
|
||||
if (customized) {
|
||||
compound.setFloat("Speed", speed);
|
||||
compound.setByte("Smooth", smooth);
|
||||
}
|
||||
|
||||
return compound;
|
||||
}
|
||||
|
||||
public FramePart copy() {
|
||||
FramePart part = new FramePart(this.part);
|
||||
part.rotation = new float[]{this.rotation[0], this.rotation[1], this.rotation[2]};
|
||||
part.pivot = new float[]{this.pivot[0], this.pivot[1], this.pivot[2]};
|
||||
part.customized = this.customized;
|
||||
part.speed = this.speed;
|
||||
part.smooth = this.smooth;
|
||||
return part;
|
||||
}
|
||||
|
||||
public void interpolateAngles() {
|
||||
if (paused)
|
||||
return;
|
||||
|
||||
float pi = (float) Math.PI / 180;
|
||||
if (this.smooth == 2) {
|
||||
this.prevRotations[0] = this.rotation[0] * pi;
|
||||
this.prevRotations[1] = this.rotation[1] * pi;
|
||||
this.prevRotations[2] = this.rotation[2] * pi;
|
||||
} else if (this.partialRotationTick != FramePart.renderPartialTick) {
|
||||
this.partialRotationTick = FramePart.renderPartialTick;
|
||||
if (this.smooth == 0) {
|
||||
this.prevRotations[0] = (this.rotation[0] * pi - this.prevRotations[0]) * Math.abs(this.speed) / 10f + this.prevRotations[0];
|
||||
this.prevRotations[1] = (this.rotation[1] * pi - this.prevRotations[1]) * Math.abs(this.speed) / 10f + this.prevRotations[1];
|
||||
this.prevRotations[2] = (this.rotation[2] * pi - this.prevRotations[2]) * Math.abs(this.speed) / 10f + this.prevRotations[2];
|
||||
} else {
|
||||
int directionX = Float.compare(this.rotation[0] * pi, this.prevRotations[0]);
|
||||
this.prevRotations[0] += directionX * this.speed / 10f;
|
||||
this.prevRotations[0] = directionX == 1 ?
|
||||
Math.min(this.rotation[0] * pi, this.prevRotations[0]) : Math.max(this.rotation[0] * pi, this.prevRotations[0]);
|
||||
int directionY = Float.compare(this.rotation[1] * pi, this.prevRotations[1]);
|
||||
this.prevRotations[1] += directionY * this.speed / 10f;
|
||||
this.prevRotations[1] = directionY == 1 ?
|
||||
Math.min(this.rotation[1] * pi, this.prevRotations[1]) : Math.max(this.rotation[1] * pi, this.prevRotations[1]);
|
||||
int directionZ = Float.compare(this.rotation[2] * pi, this.prevRotations[2]);
|
||||
this.prevRotations[2] += directionZ * this.speed / 10f;
|
||||
this.prevRotations[2] = directionZ == 1 ?
|
||||
Math.min(this.rotation[2] * pi, this.prevRotations[2]) : Math.max(this.rotation[2] * pi, this.prevRotations[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void interpolateOffset() {
|
||||
if (paused)
|
||||
return;
|
||||
|
||||
if (this.smooth == 2) {
|
||||
this.prevPivots[0] = this.pivot[0];
|
||||
this.prevPivots[1] = this.pivot[1];
|
||||
this.prevPivots[2] = this.pivot[2];
|
||||
} else if (this.partialPivotTick != FramePart.renderPartialTick) {
|
||||
this.partialPivotTick = FramePart.renderPartialTick;
|
||||
if (this.smooth == 0) {
|
||||
this.prevPivots[0] = (this.pivot[0] - this.prevPivots[0]) * Math.abs(this.speed) / 10f + this.prevPivots[0];
|
||||
this.prevPivots[1] = (this.pivot[1] - this.prevPivots[1]) * Math.abs(this.speed) / 10f + this.prevPivots[1];
|
||||
this.prevPivots[2] = (this.pivot[2] - this.prevPivots[2]) * Math.abs(this.speed) / 10f + this.prevPivots[2];
|
||||
} else {
|
||||
int directionX = Float.compare(this.pivot[0], this.prevPivots[0]);
|
||||
this.prevPivots[0] += directionX * this.speed / 10f;
|
||||
this.prevPivots[0] = directionX == 1 ?
|
||||
Math.min(this.pivot[0], this.prevPivots[0]) : Math.max(this.pivot[0], this.prevPivots[0]);
|
||||
int directionY = Float.compare(this.pivot[1], this.prevPivots[1]);
|
||||
this.prevPivots[1] += directionY * this.speed / 10f;
|
||||
this.prevPivots[1] = directionY == 1 ?
|
||||
Math.min(this.pivot[1], this.prevPivots[1]) : Math.max(this.pivot[1], this.prevPivots[1]);
|
||||
int directionZ = Float.compare(this.pivot[2], this.prevPivots[2]);
|
||||
this.prevPivots[2] += directionZ * this.speed / 10f;
|
||||
this.prevPivots[2] = directionZ == 1 ?
|
||||
Math.min(this.pivot[2], this.prevPivots[2]) : Math.max(this.pivot[2], this.prevPivots[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void jumpToCurrentFrame() {
|
||||
this.partialRotationTick = FramePart.renderPartialTick;
|
||||
this.partialPivotTick = FramePart.renderPartialTick;
|
||||
|
||||
this.prevPivots[0] = this.pivot[0];
|
||||
this.prevPivots[1] = this.pivot[1];
|
||||
this.prevPivots[2] = this.pivot[2];
|
||||
|
||||
float pi = (float) Math.PI / 180;
|
||||
this.prevRotations[0] = this.rotation[0] * pi;
|
||||
this.prevRotations[1] = this.rotation[1] * pi;
|
||||
this.prevRotations[2] = this.rotation[2] * pi;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import noppes.npcs.api.handler.IPlayerDialogData;
|
||||
import noppes.npcs.platform.nbt.INBTCompound;
|
||||
import noppes.npcs.platform.nbt.INBTList;
|
||||
import noppes.npcs.core.NBT;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
public class PlayerDialogData implements IPlayerDialogData {
|
||||
public HashSet<Integer> dialogsRead = new HashSet<Integer>();
|
||||
|
||||
public PlayerDialogData() {
|
||||
}
|
||||
|
||||
public void loadNBTData(INBTCompound compound) {
|
||||
HashSet<Integer> dialogsRead = new HashSet<Integer>();
|
||||
if (compound == null)
|
||||
return;
|
||||
INBTList list = compound.getList("DialogData", 10);
|
||||
if (list == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
INBTCompound nbttagcompound = list.getCompound(i);
|
||||
dialogsRead.add(nbttagcompound.getInteger("Dialog"));
|
||||
}
|
||||
this.dialogsRead = dialogsRead;
|
||||
}
|
||||
|
||||
public void saveNBTData(INBTCompound compound) {
|
||||
INBTList list = NBT.list();
|
||||
for (int dia : dialogsRead) {
|
||||
INBTCompound nbttagcompound = NBT.compound();
|
||||
nbttagcompound.setInteger("Dialog", dia);
|
||||
list.addCompound(nbttagcompound);
|
||||
}
|
||||
|
||||
compound.setList("DialogData", list);
|
||||
}
|
||||
|
||||
public boolean hasReadDialog(int id) {
|
||||
return dialogsRead.contains(id);
|
||||
}
|
||||
|
||||
public void readDialog(int id) {
|
||||
dialogsRead.add(id);
|
||||
}
|
||||
|
||||
public void unreadDialog(int id) {
|
||||
dialogsRead.remove(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import noppes.npcs.api.handler.IPlayerTransportData;
|
||||
import noppes.npcs.api.handler.data.ITransportLocation;
|
||||
import noppes.npcs.platform.nbt.INBTCompound;
|
||||
import noppes.npcs.platform.nbt.INBTList;
|
||||
import noppes.npcs.core.NBT;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
public class PlayerTransportData implements IPlayerTransportData {
|
||||
public HashSet<Integer> transports = new HashSet<Integer>();
|
||||
|
||||
public PlayerTransportData() {
|
||||
}
|
||||
|
||||
public void loadNBTData(INBTCompound compound) {
|
||||
HashSet<Integer> dialogsRead = new HashSet<Integer>();
|
||||
if (compound == null)
|
||||
return;
|
||||
INBTList list = compound.getList("TransportData", 10);
|
||||
if (list == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
INBTCompound nbttagcompound = list.getCompound(i);
|
||||
dialogsRead.add(nbttagcompound.getInteger("Transport"));
|
||||
}
|
||||
this.transports = dialogsRead;
|
||||
}
|
||||
|
||||
public void saveNBTData(INBTCompound compound) {
|
||||
INBTList list = NBT.list();
|
||||
for (int dia : transports) {
|
||||
INBTCompound nbttagcompound = NBT.compound();
|
||||
nbttagcompound.setInteger("Transport", dia);
|
||||
list.addCompound(nbttagcompound);
|
||||
}
|
||||
|
||||
compound.setList("TransportData", list);
|
||||
}
|
||||
|
||||
public boolean hasTransport(int id) {
|
||||
return transports.contains(id);
|
||||
}
|
||||
|
||||
public void addTransport(int id) {
|
||||
transports.add(id);
|
||||
}
|
||||
|
||||
public void addTransport(ITransportLocation location) {
|
||||
transports.add(location.getId());
|
||||
}
|
||||
|
||||
public ITransportLocation getTransport(int id) {
|
||||
return null; // Resolved in version-specific code
|
||||
}
|
||||
|
||||
public ITransportLocation[] getTransports() {
|
||||
return new ITransportLocation[0]; // Resolved in version-specific code
|
||||
}
|
||||
|
||||
public void removeTransport(int id) {
|
||||
transports.remove(id);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user