File tree Expand file tree Collapse file tree 3 files changed +27
-13
lines changed
plugin/src/main/java/org/battleplugins/arena Expand file tree Collapse file tree 3 files changed +27
-13
lines changed Original file line number Diff line number Diff line change @@ -115,8 +115,20 @@ public void onEnable() {
115
115
// Register default arenas
116
116
this .registerArena (this , "Arena" , Arena .class );
117
117
118
+ // Enable the plugin
118
119
this .enable ();
119
120
121
+ // Enable modules
122
+ this .moduleLoader .enableModules ();
123
+
124
+ // Register base command
125
+ PluginCommand command = this .getCommand ("battlearena" );
126
+ if (command == null ) {
127
+ throw new IllegalArgumentException ("Failed to register command 'battlearena'. Was it not registered?" );
128
+ }
129
+
130
+ command .setExecutor (new BACommandExecutor ("battlearena" ));
131
+
120
132
// Loads all arena loaders
121
133
this .loadArenaLoaders (this .arenasPath );
122
134
@@ -162,17 +174,6 @@ private void enable() {
162
174
163
175
// Clear any remaining dynamic maps
164
176
this .clearDynamicMaps ();
165
-
166
- // Enable modules
167
- this .moduleLoader .enableModules ();
168
-
169
- // Register base command
170
- PluginCommand command = this .getCommand ("battlearena" );
171
- if (command == null ) {
172
- throw new IllegalArgumentException ("Failed to register command 'battlearena'. Was it not registered?" );
173
- }
174
-
175
- command .setExecutor (new BACommandExecutor ("battlearena" ));
176
177
}
177
178
178
179
@ Override
Original file line number Diff line number Diff line change 3
3
import net .kyori .adventure .text .Component ;
4
4
import net .kyori .adventure .text .format .TextDecoration ;
5
5
import net .kyori .adventure .text .minimessage .MiniMessage ;
6
+ import org .bukkit .Bukkit ;
6
7
import org .bukkit .Material ;
7
8
import org .bukkit .NamespacedKey ;
8
9
import org .bukkit .configuration .ConfigurationSection ;
@@ -44,7 +45,19 @@ public ItemStack parse(Object object) throws ParseException {
44
45
public static ItemStack deserializeSingular (String contents ) throws ParseException {
45
46
ItemStack itemStack ;
46
47
47
- SingularValueParser .ArgumentBuffer buffer = SingularValueParser .parseNamed (contents , SingularValueParser .BraceStyle .CURLY , ';' );
48
+ SingularValueParser .ArgumentBuffer buffer ;
49
+ try {
50
+ buffer = SingularValueParser .parseNamed (contents , SingularValueParser .BraceStyle .CURLY , ';' );
51
+ } catch (ParseException e ) {
52
+ // If we get an error, let's try parsing using Minecraft's native format
53
+ try {
54
+ return Bukkit .getItemFactory ().createItemStack (contents );
55
+ } catch (IllegalArgumentException ex ) {
56
+ ex .initCause (e );
57
+ throw e ;
58
+ }
59
+ }
60
+
48
61
if (!buffer .hasNext ()) {
49
62
throw new ParseException ("No data found for ItemStack" )
50
63
.cause (ParseException .Cause .INVALID_TYPE )
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ public void loadModules() throws IOException {
112
112
public void enableModules () {
113
113
this .modules .values ().forEach (module -> {
114
114
if (this .plugin .getMainConfig ().getDisabledModules ().contains (module .module ().id ())) {
115
- this .plugin .info ("Module {} is disabled in the configuration. Skipping..." , module .module ().name ());
115
+ this .plugin .debug ("Module {} is disabled in the configuration. Skipping..." , module .module ().name ());
116
116
return ;
117
117
}
118
118
You can’t perform that action at this time.
0 commit comments