Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Commit 3ed9f96

Browse files
committed
[2.9.8-rc5] Updates and Fixes
- Fixed NullPointers from RANDOM enchant category being loaded when it shouldn't have. - Update RandomPackage to 16.5.2
1 parent 268cdee commit 3ed9f96

File tree

8 files changed

+49
-56
lines changed

8 files changed

+49
-56
lines changed

pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66
<groupId>me.puyodead1</groupId>
77
<artifactId>RPBookGUI</artifactId>
8-
<version>2.9.8-rc4</version>
8+
<version>2.9.8-rc5</version>
99
<name>RPBookGUI</name>
1010
<repositories>
1111
<repository>
@@ -28,7 +28,7 @@
2828
<dependency>
2929
<groupId>me.randomhashtags</groupId>
3030
<artifactId>randompackage</artifactId>
31-
<version>16.5.1</version>
31+
<version>16.5.2</version>
3232
<scope>provided</scope>
3333
</dependency>
3434
</dependencies>

src/main/java/io/github/puyodead1/rpbookgui/Commands/BookGUICommand.java

-11
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,15 @@
11
package io.github.puyodead1.rpbookgui.Commands;
22

3-
import java.io.File;
4-
import java.util.ArrayList;
5-
import java.util.Arrays;
6-
import java.util.HashMap;
7-
import java.util.List;
8-
93
import org.bukkit.Bukkit;
104
import org.bukkit.command.Command;
115
import org.bukkit.command.CommandExecutor;
126
import org.bukkit.command.CommandSender;
137
import org.bukkit.configuration.file.FileConfiguration;
148
import org.bukkit.entity.Player;
15-
import org.bukkit.inventory.ItemStack;
169

1710
import io.github.puyodead1.rpbookgui.Inventories;
1811
import io.github.puyodead1.rpbookgui.RPBookGUI;
1912
import io.github.puyodead1.rpbookgui.Utils.RPBookGUIUtils;
20-
import me.randomhashtags.randompackage.addon.EnchantRarity;
21-
import me.randomhashtags.randompackage.util.addon.FileCustomEnchant;
22-
import me.randomhashtags.randompackage.util.addon.FileEnchantRarity;
23-
import me.randomhashtags.randompackage.util.addon.RPAddon;
2413

2514
public class BookGUICommand implements CommandExecutor {
2615

src/main/java/io/github/puyodead1/rpbookgui/EnchantConstructor.java

-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
import java.util.HashMap;
44

5-
import org.bukkit.Bukkit;
65
import org.bukkit.inventory.ItemStack;
76

8-
import io.github.puyodead1.rpbookgui.Utils.RPBookGUIUtils;
97
import me.randomhashtags.randompackage.addon.CustomEnchant;
108
import me.randomhashtags.randompackage.addon.EnchantRarity;
119
import me.randomhashtags.randompackage.api.CustomEnchants;

src/main/java/io/github/puyodead1/rpbookgui/ItemStacks.java

-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@
2828
import io.github.puyodead1.rpbookgui.Utils.RPBookGUIUtils;
2929
import io.github.puyodead1.rpbookgui.Utils.UMaterial;
3030
import me.randomhashtags.randompackage.RandomPackage;
31-
import me.randomhashtags.randompackage.RandomPackageAPI;
3231
import me.randomhashtags.randompackage.addon.CustomEnchant;
3332
import me.randomhashtags.randompackage.addon.EnchantRarity;
34-
import me.randomhashtags.randompackage.util.RPStorage;
3533

3634
public class ItemStacks {
3735

src/main/java/io/github/puyodead1/rpbookgui/RPBookGUI.java

+23-19
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424

2525
import io.github.puyodead1.rpbookgui.Commands.BookGUICommand;
2626
import io.github.puyodead1.rpbookgui.Commands.RarityInfo;
27+
import io.github.puyodead1.rpbookgui.Events.EnchantInventoryClick;
28+
import io.github.puyodead1.rpbookgui.Events.MainInventoryClick;
2729
import io.github.puyodead1.rpbookgui.Events.RarityInventoryClick;
2830
import io.github.puyodead1.rpbookgui.Events.SettingsInventoryClick;
2931
import io.github.puyodead1.rpbookgui.Events.SuccessDestroyInventoryClick;
30-
import io.github.puyodead1.rpbookgui.Events.EnchantInventoryClick;
31-
import io.github.puyodead1.rpbookgui.Events.MainInventoryClick;
3232
import io.github.puyodead1.rpbookgui.Utils.FileCustomEnchant;
3333
import io.github.puyodead1.rpbookgui.Utils.FileEnchantRarity;
3434
import io.github.puyodead1.rpbookgui.Utils.MetricsLite;
@@ -128,6 +128,7 @@ public void InitEvents() {
128128
/**
129129
* Enable Metrics
130130
*/
131+
@SuppressWarnings("unused")
131132
public void InitMetrics() {
132133
long started = System.currentTimeMillis();
133134
MetricsLite metrics = new MetricsLite(this);
@@ -150,29 +151,32 @@ private void InitRarities() {
150151
if (folder.exists()) {
151152
for (File f : folder.listFiles()) {
152153
if (f.isDirectory()) {
153-
final File[] files = new File(p + separator + f.getName())
154-
.listFiles();
155-
if (files != null) {
156-
FileEnchantRarity rarity = null;
157-
final List<File> F = Arrays.asList(files);
158-
for (File k : F) {
159-
if (k.getName().contains("_settings")) {
160-
rarity = new FileEnchantRarity(f, k);
154+
if(!f.getName().contains("RANDOM")) {
155+
final File[] files = new File(p + separator + f.getName())
156+
.listFiles();
157+
if (files != null) {
158+
FileEnchantRarity rarity = null;
159+
final List<File> F = Arrays.asList(files);
160+
for (File k : F) {
161+
if (k.getName().contains("_settings")) {
162+
rarity = new FileEnchantRarity(f, k);
163+
}
161164
}
162-
}
163-
if (rarity != null) {
164-
for (File ff : files) {
165-
if (!ff.getName().startsWith("_settings")) {
166-
final FileCustomEnchant e = new FileCustomEnchant(
167-
ff);
168-
if(e.isEnabled()) {
169-
rarity.getEnchants().add(e);
170-
RPBookGUIUtils.enchants.put(e.getIdentifier(), e);
165+
if (rarity != null) {
166+
for (File ff : files) {
167+
if (!ff.getName().startsWith("_settings")) {
168+
final FileCustomEnchant e = new FileCustomEnchant(
169+
ff);
170+
if(e.isEnabled()) {
171+
rarity.getEnchants().add(e);
172+
RPBookGUIUtils.enchants.put(e.getIdentifier(), e);
173+
}
171174
}
172175
}
173176
}
174177
}
175178
}
179+
// Note: Random ce category causes errors, so dont load it
176180
}
177181
}
178182
}

src/main/java/io/github/puyodead1/rpbookgui/Utils/FileEnchantRarity.java

+23-18
Original file line numberDiff line numberDiff line change
@@ -29,71 +29,76 @@ public FileEnchantRarity(File folder, File f) {
2929
enchants = new ArrayList<>();
3030
addEnchantRarity(this);
3131
}
32+
3233
public String getIdentifier() {
3334
return folder.getName();
3435
}
3536

3637
public String[] getRevealedEnchantRarities() {
3738
return yml.getString("reveals enchant rarities").split(";");
3839
}
40+
3941
public List<String> getRevealedEnchantMsg() {
4042
if (revealedEnchantMsg == null)
41-
revealedEnchantMsg = api.colorizeListString(
42-
yml.getStringList("reveal enchant msg"));
43+
revealedEnchantMsg = api.colorizeListString(yml.getStringList("reveal enchant msg"));
4344
return revealedEnchantMsg;
4445
}
46+
4547
public ItemStack getRevealItem() {
4648
if (revealItem == null)
4749
revealItem = api.d(yml, "reveal item");
4850
return getClone(revealItem, null);
4951
}
52+
5053
public ItemStack getRevealedItem() {
5154
if (revealedItem == null)
5255
revealedItem = api.d(yml, "revealed item");
5356
return getClone(revealedItem, null);
5457
}
58+
5559
public String getNameColors() {
56-
return ChatColor.translateAlternateColorCodes('&',
57-
yml.getString("revealed item.name colors"));
60+
return ChatColor.translateAlternateColorCodes('&', yml.getString("revealed item.name colors"));
5861
}
62+
5963
public String getApplyColors() {
60-
return ChatColor.translateAlternateColorCodes('&',
61-
yml.getString("revealed item.apply colors"));
64+
return ChatColor.translateAlternateColorCodes('&', yml.getString("revealed item.apply colors"));
6265
}
66+
6367
public boolean percentsAddUpto100() {
6468
return yml.getBoolean("settings.success+destroy=100");
6569
}
70+
6671
public String getSuccess() {
67-
return ChatColor.translateAlternateColorCodes('&',
68-
yml.getString("settings.success"));
72+
return ChatColor.translateAlternateColorCodes('&', yml.getString("settings.success"));
6973
}
74+
7075
public String getDestroy() {
71-
return ChatColor.translateAlternateColorCodes('&',
72-
yml.getString("settings.destroy"));
76+
return ChatColor.translateAlternateColorCodes('&', yml.getString("settings.destroy"));
7377
}
78+
7479
public List<String> getLoreFormat() {
7580
if (loreFormat == null)
76-
loreFormat = api.colorizeListString(
77-
yml.getStringList("settings.lore format"));
81+
loreFormat = api.colorizeListString(yml.getStringList("settings.lore format"));
7882
return loreFormat;
7983
}
84+
8085
public int getSuccessSlot() {
8186
return getLoreFormat().indexOf("{SUCCESS}");
8287
}
88+
8389
public int getDestroySlot() {
8490
return getLoreFormat().indexOf("{DESTROY}");
8591
}
92+
8693
public Firework getFirework() {
8794
if (firework == null) {
88-
final String[] a = yml.getString("revealed item.firework")
89-
.split(":");
90-
firework = api.createFirework(
91-
FireworkEffect.Type.valueOf(a[0].toUpperCase()),
92-
api.getColor(a[1]), api.getColor(a[2]),
93-
Integer.parseInt(a[3]));
95+
final String[] a = yml.getString("revealed item.firework").split(":");
96+
firework = api.createFirework(FireworkEffect.Type.valueOf(a[0].toUpperCase()), api.getColor(a[1]),
97+
api.getColor(a[2]), Integer.parseInt(a[3]));
9498
}
9599
return firework;
96100
}
101+
97102
public List<CustomEnchant> getEnchants() {
98103
return enchants;
99104
}

src/main/java/io/github/puyodead1/rpbookgui/Utils/ItemBuilder.java

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import java.util.Map;
77

88
import org.bukkit.Color;
9-
import org.bukkit.DyeColor;
109
import org.bukkit.Material;
1110
import org.bukkit.enchantments.Enchantment;
1211
import org.bukkit.inventory.ItemStack;

src/main/resources/plugin.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: RPBookGUI
2-
version: 2.9.8-rc4
2+
version: 2.9.8-rc5
33
author: Puyodead1
44
main: io.github.puyodead1.rpbookgui.RPBookGUI
55
depend: [RandomPackage]

0 commit comments

Comments
 (0)