12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package me.km.snuviscript;
- import java.util.HashSet;
- import me.hammerle.code.Script;
- import me.hammerle.code.SnuviParser;
- import me.km.api.Location;
- public class MinecraftScript extends Script
- {
- private final HashSet<Location> loadedLocations;
- private int invCounter;
-
- public MinecraftScript(SnuviParser parser, int id, String name, String code, boolean receiveEventBroadcast)
- {
- super(parser, id, name, code, receiveEventBroadcast);
- loadedLocations = new HashSet<>();
- invCounter = 0;
- }
- // -------------------------------------------------------------------------
- // Location Handling für Wait-For-Location
- // -------------------------------------------------------------------------
-
- public void addLocation(Location l)
- {
- l = l.copy();
- l.round();
- loadedLocations.add(l);
- }
-
- public boolean removeLocation(Location l)
- {
- l = l.copy();
- l.round();
- return loadedLocations.remove(l);
- }
-
- public void clearLocations()
- {
- loadedLocations.clear();
- }
-
- // -------------------------------------------------------------------------
- // Für Inventar-IDs
- // -------------------------------------------------------------------------
-
- public int getNewId()
- {
- invCounter++;
- return invCounter;
- }
- }
|