Skip to content

Commit

Permalink
change lang level to java 8
Browse files Browse the repository at this point in the history
  • Loading branch information
Badbird5907 committed Jun 28, 2023
1 parent e3e5f45 commit 19d1c46
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ public class BukkitPlatform implements CommanderPlatform {

public BukkitPlatform(Plugin plugin) {
this.plugin = plugin;
if (plugin.getServer().getPluginManager() instanceof SimplePluginManager manager) {
if (plugin.getServer().getPluginManager() instanceof SimplePluginManager) {
try {
Field field = SimplePluginManager.class.getDeclaredField("commandMap");
field.setAccessible(true);
commandMap = (CommandMap) field.get(manager);
commandMap = (CommandMap) field.get(plugin.getServer().getPluginManager());
} catch (IllegalArgumentException | NoSuchFieldException | IllegalAccessException | SecurityException e) {
e.printStackTrace();
}
Expand All @@ -95,7 +95,8 @@ public void handleCommandException(CommandContext ctx, CommandException e) {

@Override
public void handleCommandException(CommandInfo info, CoreCommandSender sender, CommandException e) {
if (e instanceof LocalizedCommandException lce) {
if (e instanceof LocalizedCommandException) {
LocalizedCommandException lce = (LocalizedCommandException) e;
ResponseHandler handler = lce.getResponseHandler();
if (handler == null) {
throw new NullPointerException("Could not find a instance of ResponseHandler to handle command exception: " + e.getClass().getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,8 @@ private void executeInternally(CoreCommandSender sender, String label, String[]
}
} catch (CommandException e) {
LocalizedCommandException.checkResponseHandlerNull(e, getResponseHandler());
if (e instanceof MessageException me) {
if (e instanceof MessageException) {
MessageException me = (MessageException) e;
getPlatform().handleMessage(me.getMessage(), sender);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ public static Class<?> getRawType(Type type) {
// type is a normal class.
return (Class<?>) type;

} else if (type instanceof ParameterizedType parameterizedType) {

} else if (type instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType) type;
// I'm not exactly sure why getRawType() returns Type instead of Class.
// Neal isn't either but suspects some pathological case related
// to nested classes exists.
Expand Down

0 comments on commit 19d1c46

Please sign in to comment.