Kajetan Johannes Hammerle hace 5 años
padre
commit
402810cc8c

+ 1 - 1
src/main/java/me/km/overrides/ModEntityPlayerMP.java

@@ -112,6 +112,6 @@ public class ModEntityPlayerMP extends ServerPlayerEntity
     @Override
     protected int getPermissionLevel()
     {
-        return 4;
+        return 999;
     }
 }

+ 1 - 2
src/main/java/me/km/overrides/PlayerCapeLoader.java

@@ -55,8 +55,7 @@ public class PlayerCapeLoader
             HttpURLConnection httpurlconnection = null;
             try
             {
-                org.apache.logging.log4j.LogManager.getLogger().warn(String.format("http://skins.hammerle.me/cape_%s.png", uuid));
-                httpurlconnection = (HttpURLConnection) (new URL("http://skins.hammerle.me/cape.png"))
+                httpurlconnection = (HttpURLConnection) (new URL(String.format("http://skins.hammerle.me/cape_%s.png", uuid)))
                         .openConnection(Minecraft.getInstance().getProxy());
                 httpurlconnection.setDoInput(true);
                 httpurlconnection.setDoOutput(false);

+ 5 - 5
src/main/java/me/km/permissions/ModCommandManager.java

@@ -180,6 +180,7 @@ public class ModCommandManager extends Commands
                         return 0;
                     }
                 }
+                System.out.println("execute: " + rawCommand + " " + cs.hasPermissionLevel(4));
                 return super.handleCommand(cs, rawCommand);
             }
             events.onMissingPermission(getSource(cs), commandName);
@@ -196,16 +197,15 @@ public class ModCommandManager extends Commands
         Map<CommandNode<CommandSource>, CommandNode<ISuggestionProvider>> map = Maps.newHashMap();
         RootCommandNode<ISuggestionProvider> rootcommandnode = new RootCommandNode<>();
         map.put(getDispatcher().getRoot(), rootcommandnode);
-        this.commandSourceNodesToSuggestionNodes(getDispatcher().getRoot(), rootcommandnode, player.getCommandSource(), map);
+        this.commandSourceNodesToSuggestionNodes(true, getDispatcher().getRoot(), rootcommandnode, player.getCommandSource(), map);
         player.connection.sendPacket(new SCommandListPacket(rootcommandnode));
     }
 
-    private void commandSourceNodesToSuggestionNodes(CommandNode<CommandSource> node, CommandNode<ISuggestionProvider> suggestion, CommandSource source, Map<CommandNode<CommandSource>, CommandNode<ISuggestionProvider>> commandNodeToSuggestionNode)
+    private void commandSourceNodesToSuggestionNodes(boolean first, CommandNode<CommandSource> node, CommandNode<ISuggestionProvider> suggestion, CommandSource source, Map<CommandNode<CommandSource>, CommandNode<ISuggestionProvider>> commandNodeToSuggestionNode)
     {
         for(CommandNode<CommandSource> commandnode : node.getChildren())
         {
-            if(perms.hasPermission(source, commandnode.getName()))
-            //if(commandnode.canUse(source))
+            if((first && perms.hasPermission(source, commandnode.getName()) || (!first && commandnode.canUse(source))))
             {
                 ArgumentBuilder<ISuggestionProvider, ?> argumentbuilder = (ArgumentBuilder) commandnode.createBuilder();
                 argumentbuilder.requires((p_197060_0_) ->
@@ -239,7 +239,7 @@ public class ModCommandManager extends Commands
                 suggestion.addChild(commandnode1);
                 if(!commandnode.getChildren().isEmpty())
                 {
-                    this.commandSourceNodesToSuggestionNodes(commandnode, commandnode1, source, commandNodeToSuggestionNode);
+                    this.commandSourceNodesToSuggestionNodes(false, commandnode, commandnode1, source, commandNodeToSuggestionNode);
                 }
             }
         }

+ 4 - 0
src/main/java/me/km/snuviscript/MinecraftFunctions.java

@@ -1254,6 +1254,10 @@ public class MinecraftFunctions
         { 
             Entity ent = (Entity) in[0].get(sc);
             Location l = (Location) in[1].get(sc); 
+            if(l.getWorld() == null)
+            {
+                throw new IllegalArgumentException("world must not be null");
+            }
             if(ent instanceof ServerPlayerEntity)
             {
                 ServerPlayerEntity p = (ServerPlayerEntity) ent;