|
@@ -42,6 +42,7 @@ import net.minecraft.world.World;
|
|
|
import net.minecraft.world.server.ServerWorld;
|
|
|
|
|
|
public class PlayerCommands {
|
|
|
+
|
|
|
public static void registerFunctions(ScriptManager sm, Scripts scripts,
|
|
|
Permissions perms, SnuviScheduler scheduler, MinecraftServer server,
|
|
|
IPlayerBank playerBank) {
|
|
@@ -98,7 +99,11 @@ public class PlayerCommands {
|
|
|
if(o instanceof PlayerEntity) {
|
|
|
return ((PlayerEntity) o).getName().getFormattedText();
|
|
|
}
|
|
|
- return server.getPlayerProfileCache().getProfileByUUID(getUUID(o.toString())).getName();
|
|
|
+ GameProfile gp = server.getPlayerProfileCache().getProfileByUUID(getUUID(o));
|
|
|
+ if(gp == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return gp.getName();
|
|
|
});
|
|
|
sm.registerFunction("player.getuuid", (sc, in) -> {
|
|
|
Object o = in[0].get(sc);
|
|
@@ -135,26 +140,24 @@ public class PlayerCommands {
|
|
|
case "s":
|
|
|
case "0":
|
|
|
p.setGameType(GameType.SURVIVAL);
|
|
|
- break;
|
|
|
+ return;
|
|
|
case "creative":
|
|
|
case "c":
|
|
|
case "1":
|
|
|
p.setGameType(GameType.CREATIVE);
|
|
|
- break;
|
|
|
+ return;
|
|
|
case "adventure":
|
|
|
case "a":
|
|
|
case "2":
|
|
|
p.setGameType(GameType.ADVENTURE);
|
|
|
- break;
|
|
|
+ return;
|
|
|
case "spectator":
|
|
|
case "w":
|
|
|
case "3":
|
|
|
p.setGameType(GameType.SPECTATOR);
|
|
|
- break;
|
|
|
- default:
|
|
|
- p.setGameType(GameType.CREATIVE);
|
|
|
- break;
|
|
|
+ return;
|
|
|
}
|
|
|
+ p.setGameType(GameType.CREATIVE);
|
|
|
});
|
|
|
sm.registerFunction("player.getlastdamager", (sc, in) -> {
|
|
|
DamageSource ds = ((PlayerEntity) in[0].get(sc)).getLastDamageSource();
|