Skip to content

Commit 655f235

Browse files
Merge pull request #496 from VolmitSoftware/Development
Development
2 parents 146fb29 + e113874 commit 655f235

File tree

7 files changed

+47
-13
lines changed

7 files changed

+47
-13
lines changed

src/main/java/com/volmit/adapt/Adapt.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ public void stop() {
177177
services.values().forEach(AdaptService::onDisable);
178178
sqlManager.closeConnection();
179179
stopSim();
180+
glowingEntities.disable();
180181
protectorRegistry.unregisterAll();
181182
services.clear();
182183
}

src/main/java/com/volmit/adapt/api/adaptation/Adaptation.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,11 @@ default boolean openGui(Player player, boolean checkPermissions) {
384384
}
385385

386386
default void openGui(Player player) {
387+
if (!Bukkit.isPrimaryThread()) {
388+
J.s(() -> openGui(player));
389+
return;
390+
}
391+
387392
player.getWorld().playSound(player.getLocation(), Sound.ITEM_BOOK_PAGE_TURN, 1.1f, 1.255f);
388393
player.getWorld().playSound(player.getLocation(), Sound.ITEM_BOOK_PAGE_TURN, 0.7f, 0.655f);
389394
player.getWorld().playSound(player.getLocation(), Sound.ITEM_BOOK_PAGE_TURN, 0.3f, 0.855f);

src/main/java/com/volmit/adapt/api/skill/Skill.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import com.volmit.adapt.api.xp.XP;
3232
import com.volmit.adapt.content.gui.SkillsGui;
3333
import com.volmit.adapt.util.*;
34+
import org.bukkit.Bukkit;
3435
import org.bukkit.Location;
3536
import org.bukkit.Material;
3637
import org.bukkit.Sound;
@@ -199,6 +200,11 @@ default void openGui(Player player) {
199200
if (!player.getClass().getSimpleName().equals("CraftPlayer")) {
200201
return;
201202
}
203+
if (!Bukkit.isPrimaryThread()) {
204+
J.s(() -> openGui(player));
205+
return;
206+
}
207+
202208
player.getWorld().playSound(player.getLocation(), Sound.ITEM_BOOK_PAGE_TURN, 1.1f, 1.255f);
203209
player.getWorld().playSound(player.getLocation(), Sound.ITEM_BOOK_PAGE_TURN, 0.7f, 1.455f);
204210
player.getWorld().playSound(player.getLocation(), Sound.ITEM_BOOK_PAGE_TURN, 0.3f, 1.855f);

src/main/java/com/volmit/adapt/command/CommandAdapt.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ public void gui(
7272
return;
7373
}
7474

75-
if (guiTarget.startsWith("[Skill]")) {
75+
if (guiTarget.startsWith("[Skill]-")) {
7676
for (Skill<?> skill : SkillRegistry.skills.sortV()) {
77-
if (guiTarget.equals("[Skill]" + skill.getName())) {
77+
if (guiTarget.equals("[Skill]-" + skill.getName())) {
7878
if (force || skill.openGui(targetPlayer, true)) {
7979
FConst.success("Opened GUI for " + skill.getName() + " for " + targetPlayer.getName()).send(sender());
8080
} else {
@@ -85,10 +85,10 @@ public void gui(
8585
}
8686
}
8787

88-
if (guiTarget.startsWith("[Adaptation]")) {
88+
if (guiTarget.startsWith("[Adaptation]-")) {
8989
for (Skill<?> skill : SkillRegistry.skills.sortV()) {
9090
for (Adaptation<?> adaptation : skill.getAdaptations()) {
91-
if (guiTarget.equals("[Adaptation]" + adaptation.getName())) {
91+
if (guiTarget.equals("[Adaptation]-" + adaptation.getName())) {
9292
if (force || adaptation.openGui(targetPlayer, true)) {
9393
FConst.success("Opened GUI for " + adaptation.getName() + " for " + targetPlayer.getName()).send(sender());
9494
} else {
@@ -141,7 +141,7 @@ public void experience(
141141
return;
142142
}
143143

144-
Skill<?> skill = SkillRegistry.skills.get(skillName.toString());
144+
Skill<?> skill = SkillRegistry.skills.get(skillName.name());
145145
if (skill != null) {
146146
targetPlayer.getInventory().addItem(ExperienceOrb.with(skill.getName(), amount));
147147
FConst.success("Giving " + skill.getName() + " orb").send(sender());

src/main/java/com/volmit/adapt/content/gui/SkillsGui.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,18 @@
2626
import com.volmit.adapt.api.world.PlayerSkillLine;
2727
import com.volmit.adapt.api.xp.XP;
2828
import com.volmit.adapt.util.*;
29+
import org.bukkit.Bukkit;
2930
import org.bukkit.Material;
3031
import org.bukkit.Sound;
3132
import org.bukkit.entity.Player;
3233

3334
public class SkillsGui {
3435
public static void open(Player player) {
36+
if (!Bukkit.isPrimaryThread()) {
37+
J.s(() -> open(player));
38+
return;
39+
}
40+
3541
Window w = new UIWindow(player);
3642
w.setTag("/");
3743
w.setDecorator((window, position, row) -> new UIElement("bg")

src/main/java/com/volmit/adapt/nms/GlowingEntities.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,6 @@ private enum ProtocolMappings {
10151015
"id",
10161016
"packedItems"
10171017
),
1018-
// remapping not complete: should also use remapped class names
10191018
V1_21(
10201019
21,
10211020
0,
@@ -1032,6 +1031,23 @@ private enum ProtocolMappings {
10321031
null,
10331032
null,
10341033
null
1034+
),
1035+
V1_21_REMAPPED(
1036+
21,
1037+
0,
1038+
true,
1039+
null,
1040+
null,
1041+
null,
1042+
null,
1043+
null,
1044+
null,
1045+
null,
1046+
null,
1047+
null,
1048+
null,
1049+
null,
1050+
null
10351051
)
10361052
;
10371053

src/main/java/com/volmit/adapt/util/decree/context/AdaptationListingHandler.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ public static KList<AdaptationList> getAdaptionListings() {
3232
adaptationLists.add(main);
3333

3434
for (Skill<?> skill : SkillRegistry.skills.sortV()) {
35-
AdaptationList skillList = new AdaptationList("[Skill] " + skill.getName());
35+
AdaptationList skillList = new AdaptationList("[Skill]-" + skill.getName());
3636
adaptationLists.add(skillList);
3737

3838
for (Adaptation<?> adaptation : skill.getAdaptations()) {
39-
AdaptationList adaptationList = new AdaptationList("[Adaptation] " + adaptation.getName());
39+
AdaptationList adaptationList = new AdaptationList("[Adaptation]-" + adaptation.getName());
4040
adaptationLists.add(adaptationList);
4141
}
4242
}
@@ -46,7 +46,7 @@ public static KList<AdaptationList> getAdaptionListings() {
4646
public static KList<AdaptationSkillList> getAdaptionSkillListings() {
4747
if (adaptationSkillLists.isNotEmpty()) return adaptationSkillLists;
4848

49-
AdaptationSkillList t1 = new AdaptationSkillList("[All]");
49+
AdaptationSkillList t1 = new AdaptationSkillList("[all]");
5050
adaptationSkillLists.add(t1);
5151
AdaptationSkillList t2 = new AdaptationSkillList("[random]");
5252
adaptationSkillLists.add(t2);
@@ -85,7 +85,7 @@ public boolean startsWith(String prefix) {
8585
}
8686

8787
public boolean equals(String prefix) {
88-
return name.startsWith(prefix);
88+
return name.equalsIgnoreCase(prefix);
8989
}
9090
}
9191

@@ -95,7 +95,7 @@ public boolean startsWith(String prefix) {
9595
}
9696

9797
public boolean equals(String prefix) {
98-
return name.startsWith(prefix);
98+
return name.equalsIgnoreCase(prefix);
9999
}
100100
}
101101

@@ -105,7 +105,7 @@ public boolean startsWith(String prefix) {
105105
}
106106

107107
public boolean equals(String prefix) {
108-
return name.startsWith(prefix);
108+
return name.equalsIgnoreCase(prefix);
109109
}
110110
}
111111

@@ -115,7 +115,7 @@ public boolean startsWith(String prefix) {
115115
}
116116

117117
public boolean equals(String prefix) {
118-
return name.startsWith(prefix);
118+
return name.equalsIgnoreCase(prefix);
119119
}
120120
}
121121
}

0 commit comments

Comments
 (0)