@@ -136,6 +136,8 @@ public class CommandFramework implements CommandExecutor, TabCompleter {
136
136
public static String WAIT_BEFORE_USING_AGAIN = ChatColor .RED + "You have to wait {0}s before using this command again!" ;
137
137
138
138
public CommandFramework (@ NotNull Plugin plugin ) {
139
+ this .checkRelocation ();
140
+
139
141
if (instance != null ) {
140
142
throw new IllegalStateException ("Instance already initialized!" );
141
143
}
@@ -157,6 +159,22 @@ public CommandFramework(@NotNull Plugin plugin) {
157
159
}
158
160
}
159
161
162
+ private void checkRelocation () {
163
+ String suppressRelocation = System .getProperty ("commandframework.suppressrelocation" );
164
+
165
+ if ("true" .equals (suppressRelocation )) return ;
166
+
167
+ String defaultPackage = new String (new byte [] {'m' , 'e' , '.' , 'd' , 'e' , 's' , 'p' , 'i' , 'c' , 'a' , 'l' , '.' ,
168
+ 'c' , 'o' , 'm' , 'm' , 'a' , 'n' , 'd' , 'f' , 'r' , 'a' , 'm' , 'e' , 'w' , 'o' , 'r' , 'k' });
169
+
170
+ String examplePackage = new String (new byte [] {'y' , 'o' , 'u' , 'r' , '.' , 'p' , 'a' , 'c' , 'k' , 'a' , 'g' , 'e' });
171
+ String packageName = "me.despical.commandframework" ;
172
+
173
+ if (packageName .startsWith (defaultPackage ) || packageName .startsWith (examplePackage )) {
174
+ throw new IllegalStateException ("Command Framework has not been relocated correctly!" );
175
+ }
176
+ }
177
+
160
178
/**
161
179
* For instance, can be used to translate Minecraft color and Hex color codes.
162
180
*
0 commit comments