You've already forked Arcturus-Morningstar-Extended
mirror of
https://github.com/duckietm/Arcturus-Morningstar-Extended.git
synced 2026-06-19 15:06:19 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 510e0d082e | |||
| e13c7fdbb6 | |||
| 2a28fbd2e5 | |||
| cd60cba355 | |||
| e62f461962 | |||
| 7f8c98e4f3 |
+1
-1
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.eu.habbo</groupId>
|
||||
<artifactId>Habbo</artifactId>
|
||||
<version>4.2.42</version>
|
||||
<version>4.2.44</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
+50
-1
@@ -78,12 +78,24 @@ public class FurniDataManager {
|
||||
|
||||
try {
|
||||
CachedIndex index = indexFor(source);
|
||||
|
||||
// 1. Try exact classname match (preserves *N suffix for multicolor items)
|
||||
String key = baseClassname(classname);
|
||||
String byClassname = key != null ? index.byClassname.get(key) : null;
|
||||
if (byClassname != null) {
|
||||
return new LookupResult(byClassname, diagnostic(source, itemId, classname, "matched_classname"));
|
||||
}
|
||||
|
||||
// 2. Fallback: try stripped classname (without *N suffix) for items whose
|
||||
// furnidata entry does not include the color-variant suffix.
|
||||
String strippedKey = strippedClassname(classname);
|
||||
if (strippedKey != null && !strippedKey.equals(key)) {
|
||||
String byStripped = index.byClassname.get(strippedKey);
|
||||
if (byStripped != null) {
|
||||
return new LookupResult(byStripped, diagnostic(source, itemId, classname, "matched_classname_stripped"));
|
||||
}
|
||||
}
|
||||
|
||||
String byId = index.byId.get(itemId);
|
||||
if (byId != null) {
|
||||
return new LookupResult(byId, diagnostic(source, itemId, classname, "matched_id"));
|
||||
@@ -258,21 +270,58 @@ public class FurniDataManager {
|
||||
JsonObject obj = el.getAsJsonObject();
|
||||
if (!obj.has("classname")) continue;
|
||||
|
||||
// Try exact match first (preserves *N suffix)
|
||||
String actual = baseClassname(obj.get("classname").getAsString());
|
||||
if (wanted.equals(actual)) return obj.toString();
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback: try stripped classname (without *N suffix)
|
||||
String strippedWanted = strippedClassname(classname);
|
||||
if (strippedWanted != null && !strippedWanted.equals(wanted)) {
|
||||
for (String section : SECTIONS) {
|
||||
if (!root.has(section)) continue;
|
||||
JsonObject sectionObj = root.getAsJsonObject(section);
|
||||
if (!sectionObj.has("furnitype")) continue;
|
||||
JsonArray types = sectionObj.getAsJsonArray("furnitype");
|
||||
|
||||
for (JsonElement el : types) {
|
||||
JsonObject obj = el.getAsJsonObject();
|
||||
if (!obj.has("classname")) continue;
|
||||
|
||||
String actual = strippedClassname(obj.get("classname").getAsString());
|
||||
if (strippedWanted.equals(actual)) return obj.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize a classname for index/lookup.
|
||||
*
|
||||
* Preserves the full classname including any {@code *N} color-variant suffix
|
||||
* so that multicolor items (e.g. {@code rare_dragonlamp*1}, {@code rare_dragonlamp*2})
|
||||
* each get their own index entry. The stripped variant (without {@code *N}) is
|
||||
* used as a fallback during lookup for items whose furnidata entry does not
|
||||
* include the suffix.
|
||||
*/
|
||||
private static String baseClassname(String classname) {
|
||||
if (classname == null) return null;
|
||||
String base = classname.trim().toLowerCase(java.util.Locale.ROOT);
|
||||
return base.isEmpty() ? null : base;
|
||||
}
|
||||
|
||||
/**
|
||||
* Like {@link #baseClassname(String)} but strips any trailing {@code *N}
|
||||
* color-variant suffix. Used as a fallback during lookup.
|
||||
*/
|
||||
private static String strippedClassname(String classname) {
|
||||
if (classname == null) return null;
|
||||
int star = classname.indexOf('*');
|
||||
String base = star >= 0 ? classname.substring(0, star) : classname;
|
||||
base = base.trim().toLowerCase(java.util.Locale.ROOT);
|
||||
|
||||
return base.isEmpty() ? null : base;
|
||||
}
|
||||
|
||||
|
||||
+5
@@ -25,6 +25,11 @@ public class ToggleFloorItemEvent extends MessageHandler {
|
||||
|
||||
private static HashSet<String> PET_BOXES = new HashSet<>(Arrays.asList("val11_present", "gnome_box", "leprechaun_box", "velociraptor_egg", "pterosaur_egg", "petbox_epic"));
|
||||
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
try {
|
||||
|
||||
+5
@@ -9,6 +9,11 @@ import com.eu.habbo.plugin.Event;
|
||||
import com.eu.habbo.plugin.events.furniture.FurnitureToggleEvent;
|
||||
|
||||
public class ToggleWallItemEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
|
||||
|
||||
+5
@@ -6,6 +6,11 @@ import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
|
||||
public class TriggerColorWheelEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int itemId = this.packet.readInt();
|
||||
|
||||
+5
@@ -7,6 +7,11 @@ import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
|
||||
public class TriggerDiceEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int itemId = this.packet.readInt();
|
||||
|
||||
+5
@@ -5,6 +5,11 @@ import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
|
||||
public class TriggerOneWayGateEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
if (this.client.getHabbo().getHabboInfo().getCurrentRoom() == null)
|
||||
|
||||
Reference in New Issue
Block a user