3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-10 05:20:04 +01:00

Added LocalWorld.playEffect and an implementation for Bukkit.

Dieser Commit ist enthalten in:
TomyLobo 2011-11-28 07:13:19 +01:00
Ursprung a6f0a48f84
Commit 36fbfa409f
2 geänderte Dateien mit 33 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -343,4 +343,15 @@ public abstract class LocalWorld {
public void fixLighting(Iterable<BlockVector2D> chunks) { public void fixLighting(Iterable<BlockVector2D> chunks) {
} }
/**
* Plays the minecraft effect with the given type and data at the given position.
*
* @param position
* @param type
* @param data
*/
public boolean playEffect(Vector position, int type, int data) {
return false;
}
} }

Datei anzeigen

@ -23,6 +23,7 @@ import java.lang.reflect.Constructor;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -47,6 +48,7 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.Effect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.TreeType; import org.bukkit.TreeType;
@ -57,6 +59,7 @@ import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalWorld; import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.Vector2D;
import com.sk89q.worldedit.WorldVector;
import com.sk89q.worldedit.blocks.*; import com.sk89q.worldedit.blocks.*;
import com.sk89q.worldedit.EntityType; import com.sk89q.worldedit.EntityType;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
@ -865,4 +868,23 @@ public class BukkitWorld extends LocalWorld {
} }
} }
} }
private static final Map<Integer, Effect> effects = new HashMap<Integer, Effect>();
static {
for (Effect effect : Effect.values()) {
effects.put(effect.getId(), effect);
}
}
@Override
public boolean playEffect(Vector position, int type, int data) {
final Effect effect = effects.get(type);
if (effect == null) {
return false;
}
world.playEffect(BukkitUtil.toLocation(world, position), effect, data);
return true;
}
} }