Restore auto-fill block durability

This commit is contained in:
PikaMug 2021-09-16 00:46:48 -04:00
parent bd1f0b8389
commit 845753ebf4
3 changed files with 20 additions and 19 deletions

View File

@ -152,7 +152,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
// 1 - Initialize variables
bukkitVersion = Bukkit.getServer().getBukkitVersion().split("-")[0];
settings = new Settings(this);
localeManager = new LocaleManager();
try {
Class.forName("me.pikamug.LocaleLib");
localeManager = new LocaleManager();
} catch (Exception ignored) {
getLogger().info("LocaleLib not present. Is this a debug environment?");
}
blockListener = new BlockListener(this);
itemListener = new ItemListener(this);
npcListener = new NpcListener(this);

View File

@ -360,19 +360,18 @@ public class BlocksPrompt extends QuestsEditorNumericPrompt {
} else {
two = 0;
}
if (one == two) {
if (one == two) {
final int missing;
final LinkedList<Short> durability
LinkedList<Short> durability
= (LinkedList<Short>) context.getSessionData(pref + CK.S_BREAK_DURABILITY);
if (durability != null) {
missing = one - durability.size();
} else {
missing = one;
durability = new LinkedList<>();
}
for (int i = 0; i < missing; i++) {
if (durability != null) {
durability.add((short) 0);
}
durability.add((short) 0);
}
context.setSessionData(pref + CK.S_BREAK_DURABILITY, durability);
return new BlocksPrompt(stageNum, context);
@ -733,17 +732,16 @@ public class BlocksPrompt extends QuestsEditorNumericPrompt {
}
if (one == two) {
final int missing;
final LinkedList<Short> durability
LinkedList<Short> durability
= (LinkedList<Short>) context.getSessionData(pref + CK.S_DAMAGE_DURABILITY);
if (durability != null) {
missing = one - durability.size();
} else {
missing = one;
durability = new LinkedList<>();
}
for (int i = 0; i < missing; i++) {
if (durability != null) {
durability.add((short) 0);
}
durability.add((short) 0);
}
context.setSessionData(pref + CK.S_DAMAGE_DURABILITY, durability);
return new BlocksPrompt(stageNum, context);
@ -1102,17 +1100,16 @@ public class BlocksPrompt extends QuestsEditorNumericPrompt {
}
if (one == two) {
final int missing;
final LinkedList<Short> durability
LinkedList<Short> durability
= (LinkedList<Short>) context.getSessionData(pref + CK.S_PLACE_DURABILITY);
if (durability != null) {
missing = one - durability.size();
} else {
missing = one;
durability = new LinkedList<>();
}
for (int i = 0; i < missing; i++) {
if (durability != null) {
durability.add((short) 0);
}
durability.add((short) 0);
}
context.setSessionData(pref + CK.S_PLACE_DURABILITY, durability);
return new BlocksPrompt(stageNum, context);
@ -1469,17 +1466,16 @@ public class BlocksPrompt extends QuestsEditorNumericPrompt {
}
if (one == two) {
final int missing;
final LinkedList<Short> durability
LinkedList<Short> durability
= (LinkedList<Short>) context.getSessionData(pref + CK.S_USE_DURABILITY);
if (durability != null) {
missing = one - durability.size();
} else {
missing = one;
durability = new LinkedList<>();
}
for (int i = 0; i < missing; i++) {
if (durability != null) {
durability.add((short) 0);
}
durability.add((short) 0);
}
context.setSessionData(pref + CK.S_USE_DURABILITY, durability);
return new BlocksPrompt(stageNum, context);

View File

@ -26,7 +26,7 @@
<module>v1_8_R2</module>
<module>v1_8_R3</module>
<module>dist</module>
</modules>
</modules>
<repositories>
<repository>