|
@@ -93,7 +93,7 @@ public class MinecraftFunctions
|
|
|
public static void registerFunctions(SnuviParser parser)
|
|
|
{
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Command-Bibliothek
|
|
|
+ // Command-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("command.add", (sc, in) ->
|
|
|
{
|
|
@@ -113,7 +113,7 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Permission-Bibliothek
|
|
|
+ // Permission-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("perm.clear", (sc, in) ->
|
|
|
{
|
|
@@ -127,14 +127,14 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
parser.registerFunction("perm.registerplayer", (sc, in) ->
|
|
|
{
|
|
|
- KajetansMod.perms.registerPlayerGroup(UUID.fromString(in[0].getString(sc)), in[1].getInt(sc));
|
|
|
+ KajetansMod.perms.registerPlayerGroup(getUUID(in[0].get(sc)), in[1].getInt(sc));
|
|
|
return Void.TYPE;
|
|
|
});
|
|
|
- parser.registerFunction("perm.unregisterplayer", (sc, in) -> KajetansMod.perms.unregisterPlayer(UUID.fromString(in[0].getString(sc)), in[1].getInt(sc)));
|
|
|
+ parser.registerFunction("perm.unregisterplayer", (sc, in) -> KajetansMod.perms.unregisterPlayer(getUUID(in[0].get(sc)), in[1].getInt(sc)));
|
|
|
parser.registerFunction("perm.has", (sc, in) -> KajetansMod.perms.hasPermission((ICommandSender) in[0].get(sc), in[1].getString(sc)));
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Title-Bibliothek
|
|
|
+ // Title-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("title.settime", (sc, in) ->
|
|
|
{
|
|
@@ -163,7 +163,7 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Villager-Bibliothek
|
|
|
+ // Villager-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("villager.showtrades", (sc, in) ->
|
|
|
{
|
|
@@ -172,7 +172,7 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Player-Bibliothek
|
|
|
+ // Player-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("player.getitemamount", (sc, in) -> (double) InventoryUtils.searchInventoryFor(((EntityPlayer) in[0].get(sc)).inventory, (ItemStack) in[2].get(sc), in[1].getBoolean(sc)));
|
|
|
parser.registerFunction("player.removeitem", (sc, in) ->
|
|
@@ -190,11 +190,12 @@ public class MinecraftFunctions
|
|
|
parser.registerFunction("player.shootprojectile", (sc, in) -> EffectUtils.launchProjectile((EntityPlayer) in[0].get(sc), getClass(in[1].getString(sc)), in[2].getDouble(sc), in[3].get(sc)));
|
|
|
parser.registerFunction("player.respawn", (sc, in) ->
|
|
|
{
|
|
|
+ final EntityPlayerMP p = ((EntityPlayerMP) in[0].get(sc));
|
|
|
KajetansMod.scheduler.scheduleTask(() ->
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- ((EntityPlayerMP) in[0].get(sc)).connection.processClientStatus(new CPacketClientStatus(CPacketClientStatus.State.PERFORM_RESPAWN));
|
|
|
+ p.connection.processClientStatus(new CPacketClientStatus(CPacketClientStatus.State.PERFORM_RESPAWN));
|
|
|
}
|
|
|
catch(ThreadQuickExitException ex)
|
|
|
{
|
|
@@ -264,9 +265,13 @@ public class MinecraftFunctions
|
|
|
Object o = in[0].get(sc);
|
|
|
if(o instanceof EntityPlayer)
|
|
|
{
|
|
|
- return ((EntityPlayer) o).getUniqueID().toString();
|
|
|
+ return ((EntityPlayer) o).getUniqueID();
|
|
|
}
|
|
|
- return KajetansMod.playerbank.getDataBank().getUUID(o.toString());
|
|
|
+ return UUID.fromString(KajetansMod.playerbank.getDataBank().getUUID(o.toString()));
|
|
|
+ });
|
|
|
+ parser.registerFunction("player.get", (sc, in) ->
|
|
|
+ {
|
|
|
+ return KajetansMod.server.getPlayerList().getPlayerByUUID(getUUID(in[0].get(sc)));
|
|
|
});
|
|
|
parser.registerFunction("player.getip", (sc, in) -> ((EntityPlayerMP) in[0].get(sc)).connection.netManager.getRemoteAddress().toString());
|
|
|
parser.registerFunction("player.iscreative", (sc, in) -> ((EntityPlayer) in[0].get(sc)).isCreative());
|
|
@@ -298,7 +303,7 @@ public class MinecraftFunctions
|
|
|
case "2":
|
|
|
p.setGameType(GameType.ADVENTURE);
|
|
|
break;
|
|
|
- case "specator":
|
|
|
+ case "spectator":
|
|
|
case "w":
|
|
|
case "3":
|
|
|
p.setGameType(GameType.SPECTATOR);
|
|
@@ -368,9 +373,9 @@ public class MinecraftFunctions
|
|
|
if(in.length > 2)
|
|
|
{
|
|
|
return new Location(((EntityPlayer) in[0].get(sc)).world,
|
|
|
- Utils.getPlayerTarget((EntityPlayer) in[0].get(sc), in[1].getInt(sc), in[2].getBoolean(sc)));
|
|
|
+ Utils.getTargetBlock((EntityPlayer) in[0].get(sc), in[1].getInt(sc), in[2].getBoolean(sc)));
|
|
|
}
|
|
|
- return new Location(((EntityPlayer) in[0].get(sc)).world, Utils.getPlayerTarget((EntityPlayer) in[0].get(sc), in[1].getInt(sc)));
|
|
|
+ return new Location(((EntityPlayer) in[0].get(sc)).world, Utils.getTargetBlock((EntityPlayer) in[0].get(sc), in[1].getInt(sc)));
|
|
|
});
|
|
|
|
|
|
parser.registerFunction("player.gettargetentity", (sc, in) -> Utils.getTargetedEntity((EntityPlayer) in[0].get(sc), in[1].getDouble(sc), getClass(in[2].getString(sc))));
|
|
@@ -409,7 +414,7 @@ public class MinecraftFunctions
|
|
|
parser.registerFunction("player.silentjoin", (sc, in) -> KajetansMod.perms.hasPermission((EntityPlayer) in[0].get(sc), Permissions.SILENT) && KajetansMod.generalCommands.getCommand(CommandSilent.class).silentjoin);
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Players-Bibliothek
|
|
|
+ // Players-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("players.getamount", (sc, in) -> (double) KajetansMod.server.getCurrentPlayerCount());
|
|
|
parser.registerFunction("players.tolist", (sc, in) ->
|
|
@@ -430,7 +435,7 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Rank-Bibliothek
|
|
|
+ // Rank-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("rank.get", (sc, in) ->
|
|
|
{
|
|
@@ -444,7 +449,7 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
parser.registerFunction("rank.player", (sc, in) ->
|
|
|
{
|
|
|
- KajetansMod.chatManager.registerPlayerRank(UUID.fromString(in[0].getString(sc)), in[1].getString(sc));
|
|
|
+ KajetansMod.chatManager.registerPlayerRank(getUUID(in[0].get(sc)), in[1].getString(sc));
|
|
|
return Void.TYPE;
|
|
|
});
|
|
|
parser.registerFunction("rank.clear", (sc, in) ->
|
|
@@ -454,7 +459,7 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Custom-Bibliothek
|
|
|
+ // Custom-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
/*parser.registerFunction("custom.registershapelessrecipe", (sc, in) ->
|
|
|
{
|
|
@@ -500,7 +505,7 @@ public class MinecraftFunctions
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // World-Bibliothek
|
|
|
+ // World-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
|
|
|
parser.registerAlias("players.toworldlist", "world.getplayers");
|
|
@@ -545,7 +550,7 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Item-Bibliothek
|
|
|
+ // Item-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("item.drop", (sc, in) ->
|
|
|
{
|
|
@@ -612,7 +617,7 @@ public class MinecraftFunctions
|
|
|
parser.registerFunction("item.gettooltype", (sc, in) -> Utils.getToolType((ItemStack) in[0].get(sc)));
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Location-Bibliothek
|
|
|
+ // Location-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("loc.new", (sc, in) ->
|
|
|
{
|
|
@@ -708,7 +713,7 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Block-Bibliothek
|
|
|
+ // Block-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("block.gettype", (sc, in) ->
|
|
|
{
|
|
@@ -817,19 +822,19 @@ public class MinecraftFunctions
|
|
|
TileEntityChest chest = (TileEntityChest) te;
|
|
|
if(chest.adjacentChestXNeg != null)
|
|
|
{
|
|
|
- return chest.adjacentChestXNeg.getPos();
|
|
|
+ return new Location(l.getWorld(), chest.adjacentChestXNeg.getPos());
|
|
|
}
|
|
|
if(chest.adjacentChestXPos != null)
|
|
|
{
|
|
|
- return chest.adjacentChestXPos.getPos();
|
|
|
+ return new Location(l.getWorld(), chest.adjacentChestXPos.getPos());
|
|
|
}
|
|
|
if(chest.adjacentChestZNeg != null)
|
|
|
{
|
|
|
- return chest.adjacentChestZNeg.getPos();
|
|
|
+ return new Location(l.getWorld(), chest.adjacentChestZNeg.getPos());
|
|
|
}
|
|
|
if(chest.adjacentChestZPos != null)
|
|
|
{
|
|
|
- return chest.adjacentChestZPos.getPos();
|
|
|
+ return new Location(l.getWorld(), chest.adjacentChestZPos.getPos());
|
|
|
}
|
|
|
return null;
|
|
|
});
|
|
@@ -899,7 +904,7 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Event-Bibliothek
|
|
|
+ // Event-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("event.addmovedata", (sc, in) -> (double) CustomEventCaller.registerMoveData(new PlayerMoveData(
|
|
|
sc, (Location) in[0].get(sc), (Location) in[1].get(sc), in[2].getInt(sc), in[3].getInt(sc))));
|
|
@@ -910,7 +915,7 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Skill-Bibliothek
|
|
|
+ // Skill-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("skill.register", (sc, in) ->
|
|
|
{
|
|
@@ -948,7 +953,7 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Job-Bibliothek
|
|
|
+ // Job-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("job.getlevel", (sc, in) -> (double) KajetansMod.jobs.getLevel((EntityPlayer) in[0].get(sc), in[1].getByte(sc)));
|
|
|
parser.registerFunction("job.addlevel", (sc, in) ->
|
|
@@ -1280,7 +1285,7 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Status-Bibliothek
|
|
|
+ // Status-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("status.getmana", (sc, in) -> (double) EnvironmentAPI.getMana(((EntityPlayer) in[0].get(sc))));
|
|
|
parser.registerFunction("status.getcold", (sc, in) -> (double) EnvironmentAPI.getCold(((EntityPlayer) in[0].get(sc))));
|
|
@@ -1333,21 +1338,36 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // GMap-Bibliothek
|
|
|
+ // GMap-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("gmap.removeall", (sc, in) ->
|
|
|
{
|
|
|
- KajetansMod.scripts.getDataBank(ScriptBank.class).removeMap(in[0].getString(sc));
|
|
|
+ final String map = in[0].getString(sc);
|
|
|
+ KajetansMod.scheduler.getWorker().add(() ->
|
|
|
+ {
|
|
|
+ KajetansMod.scripts.getDataBank(ScriptBank.class).removeMap(map);
|
|
|
+ });
|
|
|
return Void.TYPE;
|
|
|
});
|
|
|
parser.registerFunction("gmap.add", (sc, in) ->
|
|
|
{
|
|
|
- KajetansMod.scripts.getDataBank(ScriptBank.class).addMapElement(in[0].getString(sc), in[1].getString(sc), in[2].getString(sc));
|
|
|
+ final String map = in[0].getString(sc);
|
|
|
+ final String key = in[1].getString(sc);
|
|
|
+ final String value = in[2].getString(sc);
|
|
|
+ KajetansMod.scheduler.getWorker().add(() ->
|
|
|
+ {
|
|
|
+ KajetansMod.scripts.getDataBank(ScriptBank.class).addMapElement(map, key, value);
|
|
|
+ });
|
|
|
return Void.TYPE;
|
|
|
});
|
|
|
parser.registerFunction("gmap.remove", (sc, in) ->
|
|
|
{
|
|
|
- KajetansMod.scripts.getDataBank(ScriptBank.class).removeMapElement(in[0].getString(sc), in[1].getString(sc));
|
|
|
+ final String map = in[0].getString(sc);
|
|
|
+ final String key = in[1].getString(sc);
|
|
|
+ KajetansMod.scheduler.getWorker().add(() ->
|
|
|
+ {
|
|
|
+ KajetansMod.scripts.getDataBank(ScriptBank.class).removeMapElement(map, key);
|
|
|
+ });
|
|
|
return Void.TYPE;
|
|
|
});
|
|
|
parser.registerFunction("gmap.totable", (sc, in) ->
|
|
@@ -1367,28 +1387,50 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // GDMap-Bibliothek
|
|
|
+ // GDMap-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("gdmap.removeall", (sc, in) ->
|
|
|
{
|
|
|
if(in.length >= 2)
|
|
|
{
|
|
|
- KajetansMod.scripts.getDataBank(ScriptBank.class).removeDualMapElement(in[0].getString(sc), in[1].getString(sc));
|
|
|
+ final String map = in[0].getString(sc);
|
|
|
+ final String key = in[1].getString(sc);
|
|
|
+ KajetansMod.scheduler.getWorker().add(() ->
|
|
|
+ {
|
|
|
+ KajetansMod.scripts.getDataBank(ScriptBank.class).removeDualMapElement(map, key);
|
|
|
+ });
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- KajetansMod.scripts.getDataBank(ScriptBank.class).removeDualMap(in[0].getString(sc));
|
|
|
+ final String map = in[0].getString(sc);
|
|
|
+ KajetansMod.scheduler.getWorker().add(() ->
|
|
|
+ {
|
|
|
+ KajetansMod.scripts.getDataBank(ScriptBank.class).removeDualMap(map);
|
|
|
+ });
|
|
|
}
|
|
|
return Void.TYPE;
|
|
|
});
|
|
|
parser.registerFunction("gdmap.add", (sc, in) ->
|
|
|
{
|
|
|
- KajetansMod.scripts.getDataBank(ScriptBank.class).addDualMapElement(in[0].getString(sc), in[1].getString(sc), in[2].getString(sc), in[3].getString(sc));
|
|
|
+ final String map = in[0].getString(sc);
|
|
|
+ final String key1 = in[1].getString(sc);
|
|
|
+ final String key2 = in[2].getString(sc);
|
|
|
+ final String value = in[3].getString(sc);
|
|
|
+ KajetansMod.scheduler.getWorker().add(() ->
|
|
|
+ {
|
|
|
+ KajetansMod.scripts.getDataBank(ScriptBank.class).addDualMapElement(map, key1, key2, value);
|
|
|
+ });
|
|
|
return Void.TYPE;
|
|
|
});
|
|
|
parser.registerFunction("gdmap.remove", (sc, in) ->
|
|
|
{
|
|
|
- KajetansMod.scripts.getDataBank(ScriptBank.class).removeDualMapElement(in[0].getString(sc), in[1].getString(sc), in[2].getString(sc));
|
|
|
+ final String map = in[0].getString(sc);
|
|
|
+ final String key1 = in[1].getString(sc);
|
|
|
+ final String key2 = in[2].getString(sc);
|
|
|
+ KajetansMod.scheduler.getWorker().add(() ->
|
|
|
+ {
|
|
|
+ KajetansMod.scripts.getDataBank(ScriptBank.class).removeDualMapElement(map, key1, key2);
|
|
|
+ });
|
|
|
return Void.TYPE;
|
|
|
});
|
|
|
parser.registerFunction("gdmap.totable", (sc, in) ->
|
|
@@ -1411,7 +1453,7 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Table-Bibliothek
|
|
|
+ // Table-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("table.print", (sc, in) ->
|
|
|
{
|
|
@@ -1486,22 +1528,25 @@ public class MinecraftFunctions
|
|
|
parser.registerFunction("table.getsize", (sc, in) -> (double) ((Table) in[0].get(sc)).getSize());
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Plot-Bibliothek
|
|
|
+ // Plot-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("plot.hastag", (sc, in) -> KajetansMod.plots.getDataBank(ProtectionBank.class).hasTag(((Location) in[0].get(sc)).getWorld(), ((Location) in[0].get(sc)).getBlockPos(), in[1].getString(sc)));
|
|
|
parser.registerFunction("plot.add", (sc, in) ->
|
|
|
{
|
|
|
- Location l1 = (Location) in[0].get(sc);
|
|
|
- Location l2 = (Location) in[1].get(sc);
|
|
|
- BlockPos pos1 = l1.getBlockPos();
|
|
|
- BlockPos pos2 = l2.getBlockPos();
|
|
|
- KajetansMod.plots.getDataBank(ProtectionBank.class).addPlot(Math.min(pos1.getX(), pos2.getX()),
|
|
|
- Math.min(pos1.getY(), pos2.getY()),
|
|
|
- Math.min(pos1.getZ(), pos2.getZ()),
|
|
|
- Math.max(pos1.getX(), pos2.getX()),
|
|
|
- Math.max(pos1.getY(), pos2.getY()),
|
|
|
- Math.max(pos1.getZ(), pos2.getZ()),
|
|
|
- ModDimensions.getWorldName(l1.getWorld()), null, in[2].getString(sc));
|
|
|
+ final Location l1 = (Location) in[0].get(sc);
|
|
|
+ final Location l2 = (Location) in[1].get(sc);
|
|
|
+ final BlockPos pos1 = l1.getBlockPos();
|
|
|
+ final BlockPos pos2 = l2.getBlockPos();
|
|
|
+ KajetansMod.scheduler.getWorker().add(() ->
|
|
|
+ {
|
|
|
+ KajetansMod.plots.getDataBank(ProtectionBank.class).addPlot(Math.min(pos1.getX(), pos2.getX()),
|
|
|
+ Math.min(pos1.getY(), pos2.getY()),
|
|
|
+ Math.min(pos1.getZ(), pos2.getZ()),
|
|
|
+ Math.max(pos1.getX(), pos2.getX()),
|
|
|
+ Math.max(pos1.getY(), pos2.getY()),
|
|
|
+ Math.max(pos1.getZ(), pos2.getZ()),
|
|
|
+ ModDimensions.getWorldName(l1.getWorld()), null, in[2].getString(sc));
|
|
|
+ });
|
|
|
return Void.TYPE;
|
|
|
});
|
|
|
parser.registerFunction("plot.getids", (sc, in) ->
|
|
@@ -1536,7 +1581,7 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Script-Bibliothek
|
|
|
+ // Script-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("script.playerstolist", (sc, in) ->
|
|
|
{
|
|
@@ -1579,7 +1624,7 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Scoreboard-Bibliothek
|
|
|
+ // Scoreboard-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("sb.add", (sc, in) ->
|
|
|
{
|
|
@@ -1601,7 +1646,7 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Display-Bibliothek
|
|
|
+ // Display-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("display.add", (sc, in) ->
|
|
|
{
|
|
@@ -1623,7 +1668,7 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // ItemStack-Display-Bibliothek
|
|
|
+ // ItemStack-Display-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("stacks.set", (sc, in) ->
|
|
|
{
|
|
@@ -1660,7 +1705,7 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Head-Bibliothek
|
|
|
+ // Head-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("head.add", (sc, in) ->
|
|
|
{
|
|
@@ -1685,7 +1730,7 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Effect-Bibliothek
|
|
|
+ // Effect-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("effect.playsound", (sc, in) ->
|
|
|
{
|
|
@@ -1702,7 +1747,7 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Inventory-Bibliothek
|
|
|
+ // Inventory-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("inv.new", (sc, in) ->
|
|
|
{
|
|
@@ -1776,7 +1821,7 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Read-Bibliothek
|
|
|
+ // Read-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("read.player", (sc, in) ->
|
|
|
{
|
|
@@ -1822,7 +1867,7 @@ public class MinecraftFunctions
|
|
|
parser.registerFunction("read.spawnmob", (sc, in) -> NBTUtils.fromString(SnuviUtils.connect(sc, in, 1).replace('\'', '"'), (Location) in[0].get(sc)));
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Text-Bibliothek
|
|
|
+ // Text-library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("text.location", (sc, in) -> ((Location) in[0].get(sc)).toString());
|
|
|
parser.registerFunction("text.locationblock", (sc, in) -> ((Location) in[0].get(sc)).toBlockString());
|
|
@@ -1831,7 +1876,12 @@ public class MinecraftFunctions
|
|
|
parser.registerFunction("text.hover", (sc, in) -> NBTUtils.getHoverable(in[0].get(sc), in[1].getString(sc)));
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
- // Ohne Bibliothek
|
|
|
+ // worker library
|
|
|
+ // ---------------------------------------------------------------------
|
|
|
+ parser.registerFunction("worker.haswork", (sc, in) -> KajetansMod.scheduler.getWorker().hasWork());
|
|
|
+
|
|
|
+ // ---------------------------------------------------------------------
|
|
|
+ // Ohne library
|
|
|
// ---------------------------------------------------------------------
|
|
|
parser.registerFunction("getglobalvar", (sc, in) ->
|
|
|
{
|
|
@@ -1840,7 +1890,7 @@ public class MinecraftFunctions
|
|
|
{
|
|
|
if(o instanceof EntityPlayer)
|
|
|
{
|
|
|
- return KajetansMod.scripts.getDataBank(ScriptBank.class).getVar(in[1].getString(sc), ((EntityPlayer) o).getUniqueID().toString());
|
|
|
+ return KajetansMod.scripts.getDataBank(ScriptBank.class).getVar(in[1].getString(sc), ((EntityPlayer) o).getCachedUniqueIdString());
|
|
|
}
|
|
|
else if(o.equals("SERVER"))
|
|
|
{
|
|
@@ -1850,7 +1900,7 @@ public class MinecraftFunctions
|
|
|
}
|
|
|
if(o instanceof EntityPlayer)
|
|
|
{
|
|
|
- return KajetansMod.scripts.getDataBank(ScriptBank.class).getVar(in[1].getString(sc), ((EntityPlayer) o).getUniqueID().toString(), in[2].get(sc));
|
|
|
+ return KajetansMod.scripts.getDataBank(ScriptBank.class).getVar(in[1].getString(sc), ((EntityPlayer) o).getCachedUniqueIdString(), in[2].get(sc));
|
|
|
}
|
|
|
else if(o.equals("SERVER"))
|
|
|
{
|
|
@@ -1861,37 +1911,50 @@ public class MinecraftFunctions
|
|
|
parser.registerAlias("getglobalvar", "ggv");
|
|
|
parser.registerFunction("setglobalvar", (sc, in) ->
|
|
|
{
|
|
|
- Object o = in[0].get(sc);
|
|
|
+ final Object o = in[0].get(sc);
|
|
|
+ final String value = in[2].getString(sc);
|
|
|
+ final String var = in[1].getString(sc);
|
|
|
+ String uuid;
|
|
|
if(o instanceof EntityPlayer)
|
|
|
{
|
|
|
- KajetansMod.scripts.getDataBank(ScriptBank.class).setVar(in[2].getString(sc), in[1].getString(sc), ((EntityPlayer) o).getUniqueID().toString());
|
|
|
+ uuid = ((EntityPlayer) o).getCachedUniqueIdString();
|
|
|
}
|
|
|
else if(o.equals("SERVER"))
|
|
|
{
|
|
|
- KajetansMod.scripts.getDataBank(ScriptBank.class).setVar(in[2].getString(sc), in[1].getString(sc), "-1");
|
|
|
+ uuid = "-1";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- KajetansMod.scripts.getDataBank(ScriptBank.class).setVar(in[2].getString(sc), in[1].getString(sc), o.toString());
|
|
|
+ uuid = o.toString();
|
|
|
}
|
|
|
+ KajetansMod.scheduler.getWorker().add(() ->
|
|
|
+ {
|
|
|
+ KajetansMod.scripts.getDataBank(ScriptBank.class).setVar(value, var, uuid);
|
|
|
+ });
|
|
|
return Void.TYPE;
|
|
|
});
|
|
|
parser.registerAlias("setglobalvar", "sgv");
|
|
|
parser.registerFunction("delglobalvar", (sc, in) ->
|
|
|
{
|
|
|
- Object o = in[0].get(sc);
|
|
|
+ final Object o = in[0].get(sc);
|
|
|
+ final String var = in[1].getString(sc);
|
|
|
+ String uuid;
|
|
|
if(o instanceof EntityPlayer)
|
|
|
{
|
|
|
- KajetansMod.scripts.getDataBank(ScriptBank.class).deleteVar(in[1].getString(sc), ((EntityPlayer) o).getUniqueID().toString());
|
|
|
+ uuid = ((EntityPlayer) o).getCachedUniqueIdString();
|
|
|
}
|
|
|
else if(o.equals("SERVER"))
|
|
|
{
|
|
|
- KajetansMod.scripts.getDataBank(ScriptBank.class).deleteVar(in[1].getString(sc), "-1");
|
|
|
+ uuid = "-1";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- KajetansMod.scripts.getDataBank(ScriptBank.class).deleteVar(in[1].getString(sc), o.toString());
|
|
|
+ uuid = o.toString();
|
|
|
}
|
|
|
+ KajetansMod.scheduler.getWorker().add(() ->
|
|
|
+ {
|
|
|
+ KajetansMod.scripts.getDataBank(ScriptBank.class).deleteVar(var, uuid);
|
|
|
+ });
|
|
|
return Void.TYPE;
|
|
|
});
|
|
|
parser.registerAlias("delglobalvar", "dgv");
|
|
@@ -1915,7 +1978,8 @@ public class MinecraftFunctions
|
|
|
});
|
|
|
parser.registerFunction("command", (sc, in) ->
|
|
|
{
|
|
|
- KajetansMod.scheduler.scheduleTask(() -> KajetansMod.server.commandManager.executeCommand(KajetansMod.server, SnuviUtils.connect(sc, in, 0)));
|
|
|
+ final String s = SnuviUtils.connect(sc, in, 0);
|
|
|
+ KajetansMod.scheduler.scheduleTask(() -> KajetansMod.server.commandManager.executeCommand(KajetansMod.server, s));
|
|
|
return Void.TYPE;
|
|
|
});
|
|
|
}
|
|
@@ -1932,19 +1996,24 @@ public class MinecraftFunctions
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // ---------------------------------------------------------------------------------
|
|
|
- // Block
|
|
|
- // ---------------------------------------------------------------------------------
|
|
|
-
|
|
|
private static IBlockState getBlockState(Location l)
|
|
|
{
|
|
|
return l.getWorld().getBlockState(l.getBlockPos());
|
|
|
}
|
|
|
|
|
|
- // ---------------------------------------------------------------------------------
|
|
|
- // Gruppen-Handler
|
|
|
- // ---------------------------------------------------------------------------------
|
|
|
-
|
|
|
+ private static UUID getUUID(Object o)
|
|
|
+ {
|
|
|
+ if(o instanceof EntityPlayer)
|
|
|
+ {
|
|
|
+ return ((EntityPlayer) o).getUniqueID();
|
|
|
+ }
|
|
|
+ else if(o instanceof UUID)
|
|
|
+ {
|
|
|
+ return (UUID) o;
|
|
|
+ }
|
|
|
+ return UUID.fromString(o.toString());
|
|
|
+ }
|
|
|
+
|
|
|
public static void doForGroup(Object group, Script sc, Consumer<ICommandSender> c)
|
|
|
{
|
|
|
if(group instanceof String)
|