Bukkit  1.5.2-R1.0
 All Classes Namespaces Files Functions Variables Enumerator Pages
World.java
Go to the documentation of this file.
1 package org.bukkit;
2 
3 import java.io.File;
4 import org.bukkit.generator.ChunkGenerator;
5 import java.util.Collection;
6 import java.util.HashMap;
7 import java.util.List;
8 import java.util.Map;
9 import java.util.UUID;
10 
11 import org.bukkit.block.Biome;
12 import org.bukkit.block.Block;
13 import org.bukkit.entity.*;
14 import org.bukkit.generator.BlockPopulator;
15 import org.bukkit.inventory.ItemStack;
16 import org.bukkit.metadata.Metadatable;
17 import org.bukkit.plugin.messaging.PluginMessageRecipient;
18 import org.bukkit.util.Vector;
19 
23 public interface World extends PluginMessageRecipient, Metadatable {
24 
34  public Block getBlockAt(int x, int y, int z);
35 
43  public Block getBlockAt(Location location);
44 
54  public int getBlockTypeIdAt(int x, int y, int z);
55 
63  public int getBlockTypeIdAt(Location location);
64 
72  public int getHighestBlockYAt(int x, int z);
73 
80  public int getHighestBlockYAt(Location location);
81 
89  public Block getHighestBlockAt(int x, int z);
90 
97  public Block getHighestBlockAt(Location location);
98 
106  public Chunk getChunkAt(int x, int z);
107 
114  public Chunk getChunkAt(Location location);
115 
122  public Chunk getChunkAt(Block block);
123 
130  public boolean isChunkLoaded(Chunk chunk);
131 
137  public Chunk[] getLoadedChunks();
138 
144  public void loadChunk(Chunk chunk);
145 
153  public boolean isChunkLoaded(int x, int z);
154 
162  public boolean isChunkInUse(int x, int z);
163 
173  public void loadChunk(int x, int z);
174 
183  public boolean loadChunk(int x, int z, boolean generate);
184 
193  public boolean unloadChunk(Chunk chunk);
194 
204  public boolean unloadChunk(int x, int z);
205 
216  public boolean unloadChunk(int x, int z, boolean save);
217 
227  public boolean unloadChunk(int x, int z, boolean save, boolean safe);
228 
238  public boolean unloadChunkRequest(int x, int z);
239 
248  public boolean unloadChunkRequest(int x, int z, boolean safe);
249 
257  public boolean regenerateChunk(int x, int z);
258 
266  public boolean refreshChunk(int x, int z);
267 
275  public Item dropItem(Location location, ItemStack item);
276 
284  public Item dropItemNaturally(Location location, ItemStack item);
285 
295  public Arrow spawnArrow(Location location, Vector velocity, float speed, float spread);
296 
304  public boolean generateTree(Location location, TreeType type);
305 
314  public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate);
315 
323  public Entity spawnEntity(Location loc, EntityType type);
324 
333  @Deprecated
334  public LivingEntity spawnCreature(Location loc, EntityType type);
335 
343  @Deprecated
344  public LivingEntity spawnCreature(Location loc, CreatureType type);
345 
352  public LightningStrike strikeLightning(Location loc);
353 
360  public LightningStrike strikeLightningEffect(Location loc);
361 
367  public List<Entity> getEntities();
368 
374  public List<LivingEntity> getLivingEntities();
375 
382  @Deprecated
383  public <T extends Entity> Collection<T> getEntitiesByClass(Class<T>... classes);
384 
391  public <T extends Entity> Collection<T> getEntitiesByClass(Class<T> cls);
392 
399  public Collection<Entity> getEntitiesByClasses(Class<?>... classes);
400 
406  public List<Player> getPlayers();
407 
413  public String getName();
414 
420  public UUID getUID();
421 
427  public Location getSpawnLocation();
428 
437  public boolean setSpawnLocation(int x, int y, int z);
438 
447  public long getTime();
448 
461  public void setTime(long time);
462 
469  public long getFullTime();
470 
480  public void setFullTime(long time);
481 
487  public boolean hasStorm();
488 
495  public void setStorm(boolean hasStorm);
496 
502  public int getWeatherDuration();
503 
509  public void setWeatherDuration(int duration);
510 
516  public boolean isThundering();
517 
523  public void setThundering(boolean thundering);
524 
530  public int getThunderDuration();
531 
537  public void setThunderDuration(int duration);
538 
548  public boolean createExplosion(double x, double y, double z, float power);
549 
561  public boolean createExplosion(double x, double y, double z, float power, boolean setFire);
562 
575  public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks);
576 
584  public boolean createExplosion(Location loc, float power);
585 
595  public boolean createExplosion(Location loc, float power, boolean setFire);
596 
602  public Environment getEnvironment();
603 
609  public long getSeed();
610 
616  public boolean getPVP();
617 
623  public void setPVP(boolean pvp);
624 
630  public ChunkGenerator getGenerator();
631 
635  public void save();
636 
642  public List<BlockPopulator> getPopulators();
643 
653  public <T extends Entity> T spawn(Location location, Class<T> clazz) throws IllegalArgumentException;
654 
668  public FallingBlock spawnFallingBlock(Location location, Material material, byte data) throws IllegalArgumentException;
669 
680  public FallingBlock spawnFallingBlock(Location location, int blockId, byte blockData) throws IllegalArgumentException;
681 
689  public void playEffect(Location location, Effect effect, int data);
690 
699  public void playEffect(Location location, Effect effect, int data, int radius);
700 
708  public <T> void playEffect(Location location, Effect effect, T data);
709 
718  public <T> void playEffect(Location location, Effect effect, T data, int radius);
719 
730  public ChunkSnapshot getEmptyChunkSnapshot(int x, int z, boolean includeBiome, boolean includeBiomeTempRain);
731 
738  public void setSpawnFlags(boolean allowMonsters, boolean allowAnimals);
739 
745  public boolean getAllowAnimals();
746 
752  public boolean getAllowMonsters();
753 
761  Biome getBiome(int x, int z);
762 
770  void setBiome(int x, int z, Biome bio);
771 
781  public double getTemperature(int x, int z);
782 
792  public double getHumidity(int x, int z);
793 
801  public int getMaxHeight();
802 
810  public int getSeaLevel();
811 
817  public boolean getKeepSpawnInMemory();
818 
824  public void setKeepSpawnInMemory(boolean keepLoaded);
825 
831  public boolean isAutoSave();
832 
838  public void setAutoSave(boolean value);
839 
845  public void setDifficulty(Difficulty difficulty);
846 
852  public Difficulty getDifficulty();
853 
859  public File getWorldFolder();
860 
866  public WorldType getWorldType();
867 
873  public boolean canGenerateStructures();
874 
894  public long getTicksPerAnimalSpawns();
895 
915  public void setTicksPerAnimalSpawns(int ticksPerAnimalSpawns);
916 
936  public long getTicksPerMonsterSpawns();
937 
957  public void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns);
958 
963  int getMonsterSpawnLimit();
964 
971  void setMonsterSpawnLimit(int limit);
972 
977  int getAnimalSpawnLimit();
978 
985  void setAnimalSpawnLimit(int limit);
986 
992 
999  void setWaterAnimalSpawnLimit(int limit);
1000 
1005  int getAmbientSpawnLimit();
1006 
1013  void setAmbientSpawnLimit(int limit);
1014 
1025  void playSound(Location location, Sound sound, float volume, float pitch);
1026 
1032  public String[] getGameRules();
1033 
1042  public String getGameRuleValue(String rule);
1043 
1056  public boolean setGameRuleValue(String rule, String value);
1057 
1064  public boolean isGameRule(String rule);
1065 
1069  public enum Environment {
1077  NETHER(-1),
1082 
1083  private final int id;
1084  private static final Map<Integer, Environment> lookup = new HashMap<Integer, Environment>();
1085 
1086  private Environment(int id) {
1087  this.id = id;
1088  }
1089 
1095  public int getId() {
1096  return id;
1097  }
1098 
1104  public static Environment getEnvironment(int id) {
1105  return lookup.get(id);
1106  }
1107 
1108  static {
1109  for (Environment env : values()) {
1110  lookup.put(env.getId(), env);
1111  }
1112  }
1113  }
1114 }