Many of you out there have maybe seen the Halloween plugin that TechGuard made. I am trying to update it but a 3 year old plugin that hasn't been updated I am just stumped on some things and wondering if someone can help. I can send the source code if you will like.
I have no idea what that plugin is, perhaps you could just put the errors you have in the thread and we may helo you with them, as that is what this forum is about.
My bad I forgot to do that lol the main errors I see are happening in the import classes as I will post below In the bukkit.techguard.hallowen I have this Animator.java Code: package bukkit.techguard.halloween; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileWriter; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.Random; import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; public class Animator implements Runnable{ private Halloween plugin; private Random rand = new Random(); public ArrayList<Location> chests = new ArrayList<Location>(); public Animator(Halloween instance){ plugin = instance; } public void run(){ try{ Random rand = new Random(System.currentTimeMillis()); while(plugin.isEnabled() && (Properties.ANIMATE_CHEST || Properties.ANIMATE_PLAYER)){ Thread.sleep(800+rand.nextInt(1000)); tick(plugin.getHalloweenWorld()); } }catch(Exception e){ plugin.updateTicker(); } } public void load(){ File path = new File("Halloween/data/chests.dat"); try{ if(!path.exists()){ path.getParentFile().mkdirs(); path.createNewFile(); } BufferedReader br = new BufferedReader(new InputStreamReader( new DataInputStream(new FileInputStream(path)))); String strLine; while((strLine = br.readLine()) != null){ if(!strLine.contains(",")) continue; String[] split = strLine.split(","); if(split.length != 3) continue; chests.add(new Location(plugin.getHalloweenWorld(), Integer.parseInt( split[0]), Integer.parseInt(split[1]), Integer.parseInt(split[2]))); } br.close(); }catch(Exception e){ e.printStackTrace(); } } public void registerChest(Location loc){ File path = new File("Halloween/data/chests.dat"); try{ if(!path.exists()){ path.getParentFile().mkdirs(); path.createNewFile(); } BufferedWriter bw = new BufferedWriter(new FileWriter(path, true)); bw.newLine(); bw.write(loc.getBlockX()+","+loc.getBlockY()+","+loc.getBlockZ()); bw.close() ; chests.add(loc); }catch(Exception e){ e.printStackTrace(); } } public void unregisterChest(Location location){ File path = new File("Halloween/data/chests.dat"); try{ if(!path.exists()){ path.getParentFile().mkdirs(); path.createNewFile(); } BufferedWriter bw = new BufferedWriter(new FileWriter(path, false)); for(Location loc : chests){ if(loc.equals(location)) continue; bw.newLine(); bw.write(loc.getBlockX()+","+loc.getBlockY()+","+loc.getBlockZ()); } bw.close(); chests.remove(location); }catch(Exception e){ e.printStackTrace(); } } @SuppressWarnings("deprecation") public synchronized void tick(World w){ if(Properties.ANIMATE_CHEST){ synchronized(chests){ for(Location loc : chests){ if(loc.getBlock().getType() != Material.CHEST){ unregisterChest(loc); continue; } if(!w.getChunkAt(loc).isLoaded()) continue; w.playEffect(loc, Effect.EXTINGUISH, 0); for(int i = 1; i < 10; i++){ w.playEffect(loc, Effect.SMOKE, i); } } } } if(Properties.ANIMATE_PLAYER){ List<Player> players = w.getPlayers(); synchronized(players){ for(Player p2 : players){ if(p2.getInventory().getHelmet() != null && p2.getInventory(). getHelmet().getType() == Material.JACK_O_LANTERN){ for(int i = 1; i < 10; i++){ w.playEffect(rand.nextInt(2) == 0 ? p2.getLocation() : p2.getLocation() .getBlock().getFace(BlockFace.UP).getLocation(), Effect.SMOKE, rand.nextInt(11)); } } } } } } } The error I am getting with that is the last line at .getBlock().getFace(BlockFace.UP).getLocation(), Effect.SMOKE, rand.nextInt(11)); it is the .getFase Halloween.java same issue error with .getFace Code: package bukkit.techguard.halloween; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.World.Environment; import org.bukkit.block.BlockFace; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; import bukkit.techguard.halloween.commands.*; import bukkit.techguard.halloween.listeners.*; import bukkit.techguard.halloween.world.HalloweenGenerator; /** * @author TechGuard */ public class Halloween extends JavaPlugin{ public String name, displayname, version, description; public static Halloween instance; private CommandManager commandManager; public TimeLockManager timeLocker = new TimeLockManager(this); public Animator animator = new Animator(this); public bListener bL = new bListener(this); public pListener pL = new pListener(this); public eListener eL = new eListener(this); public void onDisable() { sM("Disabled!"); } public void onEnable() { name = getDescription().getName(); displayname = getDescription().getFullName(); version = getDescription().getVersion(); description = getDescription().getDescription(); sM("Enabled!"); Properties.load(); registerEvents(); registerCommands(); instance = this; if(Properties.LOCK_TIME) timeLocker.lock(); if(Properties.ANIMATE_CHEST || Properties.ANIMATE_PLAYER){ animator.load(); new Thread(animator).start(); } } public void updateTicker(){ if(Properties.ANIMATE_CHEST || Properties.ANIMATE_PLAYER) new Thread(animator).start(); } public org.bukkit.generator.ChunkGenerator getDefaultWorldGenerator(String worldName, String id){ return new HalloweenGenerator(); } public World getHalloweenWorld(){ if(getServer().getWorld("Halloween") == null){ getServer().createWorld("Halloween", Environment.NORMAL, new HalloweenGenerator()); } World world = getServer().getWorld("Halloween"); return world; } private void registerEvents(){ PluginManager pm = getServer().getPluginManager(); pm.registerEvent(Event.Type.PLAYER_PORTAL, pL, Event.Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_INTERACT, pL, Event.Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_MOVE, pL, Event.Priority.Normal, this); pm.registerEvent(Event.Type.BLOCK_PHYSICS, bL, Event.Priority.Normal, this); pm.registerEvent(Event.Type.BLOCK_IGNITE, bL, Event.Priority.Normal, this); pm.registerEvent(Event.Type.CREATURE_SPAWN, eL, Event.Priority.Normal, this); pm.registerEvent(Event.Type.ENTITY_DAMAGE, eL, Event.Priority.Normal, this); } @SuppressWarnings("deprecation") public boolean canPortalBeAt(Location loc){ if(loc.getBlock().getFace(BlockFace.DOWN).getTypeId() == 88 || loc.getBlock().getFace(BlockFace.UP).getTypeId() == 88 || loc.getBlock().getFace(BlockFace.NORTH).getTypeId() == 88 || loc.getBlock().getFace(BlockFace.EAST).getTypeId() == 88 || loc.getBlock().getFace(BlockFace.SOUTH).getTypeId() == 88 || loc.getBlock().getFace(BlockFace.WEST).getTypeId() == 88){ return true; } return false; } @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { return commandManager.dispatch(sender, command, label, args); } private void registerCommands() { commandManager = new CommandManager(); commandManager.registerCommand(new VersionCommand(this)); } public void sM(String message){ System.out.println("["+displayname+"] "+message); } public Player getPlayer(String name){ for(Player pl : this.getServer().getOnlinePlayers()){ if(pl.getName().toLowerCase().startsWith(name.toLowerCase())){ return pl; } } return null; } } The PortalTravelAgent the errors are with import net.minecraft.server.World; import net.minecraft.server.WorldServer; import org.bukkit.craftbukkit.CraftWorld; Code: package bukkit.techguard.halloween; import java.util.ArrayList; import java.util.Random; import net.minecraft.server.World; import net.minecraft.server.WorldServer; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.TravelAgent; import org.bukkit.block.Block; import org.bukkit.craftbukkit.CraftWorld; public class PortalTravelAgent implements TravelAgent{ private Random random = new Random(System.currentTimeMillis()); public static int PORTAL = Material.PORTAL.getId(); public static int SOUL_SAND = Material.SOUL_SAND.getId(); private int searchRadius = 128; private int creationRadius = 14; private boolean canCreatePortal = true; public Location findOrCreate(Location location){ WorldServer worldServer = ((CraftWorld)location.getWorld()).getHandle(); worldServer.chunkProviderServer.forceChunkLoad = true; Location resultLocation = findPortal(location); if(resultLocation == null){ if(canCreatePortal && createPortal(location)){ resultLocation = findPortal(location); } else { resultLocation = location; } } worldServer.chunkProviderServer.forceChunkLoad = false; return resultLocation; } public Location findPortal(Location location){ World world = ((CraftWorld)location.getWorld()).getHandle(); double d0 = -1.0D; int i = 0; int j = 0; int k = 0; int l = location.getBlockX(); int i1 = location.getBlockZ(); for(int j1 = l-searchRadius; j1 <= l+searchRadius; j1++){ double d2 = j1+0.5D-location.getX(); for(int k1 = i1-searchRadius; k1 <= i1+searchRadius; k1++){ double d3 = k1+0.5D-location.getZ(); for(int l1 = 127; l1 >= 0; l1--){ if(world.getTypeId(j1, l1, k1) == PORTAL){ while(world.getTypeId(j1, l1-1, k1) == PORTAL){ l1--; } double d1 = l1+0.5D-location.getY(); double d4 = d2*d2+d1*d1+d3*d3; if(d0 < 0.0D || d4 < d0){ d0 = d4; i = j1; j = l1; k = k1; } } } } } if(d0 >= 0.0D){ double d5 = i + 0.5D; double d6 = j + 0.5D; double d1 = k + 0.5D; if(world.getTypeId(i-1, j, k) == PORTAL){ d5 -= 0.5D; } if(world.getTypeId(i+1, j, k) == PORTAL){ d5 += 0.5D; } if (world.getTypeId(i, j, k - 1) == PORTAL){ d1 -= 0.5D; } if (world.getTypeId(i, j, k + 1) == PORTAL){ d1 += 0.5D; } return new Location(location.getWorld(), d5, d6, d1, location.getYaw(), location.getPitch()); } return null; } public boolean createPortal(Location location){ World world = ((CraftWorld)location.getWorld()).getHandle(); double d0 = -1.0D; int i = location.getBlockX(); int j = location.getBlockY(); int k = location.getBlockZ(); int l = i; int i1 = j; int j1 = k; int k1 = 0; int l1 = random.nextInt(4); for(int i2 = i-creationRadius; i2 <= i+creationRadius; i2++){ double d1 = i2+0.5D-location.getX(); for(int j2 = k-creationRadius; j2 <= k+creationRadius; j2++){ double d2 = j2+0.5D-location.getZ(); label424:for(int l2 = 127; l2 >= 0; l2--){ if(world.isEmpty(i2, l2, j2)){ while(l2 > 0 && world.isEmpty(i2, l2 - 1, j2)){ l2--; } for(int k2 = l1; k2 < l1 + 4; k2++){ int j3 = k2 % 2; int i3 = 1 - j3; if(k2 % 4 >= 2){ j3 = -j3; i3 = -i3; } for(int l3 = 0; l3 < 3; l3++){ for(int k3 = 0; k3 < 4; k3++){ for(int j4 = -1; j4 < 5; j4++){ int i4 = i2+(k3 - 1)*j3+l3*i3; int k4 = l2+j4; int l4 = j2+(k3 - 1)*i3-l3*j3; if((j4 < 0 && !world.getMaterial(i4, k4, l4).isBuildable()) || (j4 >= 0 && !world.isEmpty(i4, k4, l4))){ break label424; } } } } double d3 = l2+0.5D-location.getY(); double d4 = d1*d1+d3*d3+d2*d2; if(d0 < 0.0D || d4 < d0){ d0 = d4; l = i2; i1 = l2+1; j1 = j2; k1 = k2%4; } } } } } } if(d0 < 0.0D){ for(int i2 = i-creationRadius; i2 <= i+creationRadius; i2++){ double d1 = i2+0.5D-location.getX(); for(int j2 = k-creationRadius; j2 <= k+creationRadius; j2++){ double d2 = j2+0.5D-location.getZ(); label769: for (int l2 = 127; l2 >= 0; l2--){ if(world.isEmpty(i2, l2, j2)){ while(l2 > 0 && world.isEmpty(i2, l2 - 1, j2)){ l2--; } for (int k2 = l1; k2 < l1 + 2; k2++) { int j3 = k2 % 2; int i3 = 1 - j3; for(int l3 = 0; l3 < 4; l3++) { for(int k3 = -1; k3 < 5; k3++) { int j4 = i2+(l3-1)*j3; int i4 = l2+k3; int k4 = j2+(l3-1)*i3; if((k3 < 0 && !world.getMaterial(j4, i4, k4).isBuildable()) || (k3 >= 0 && !world.isEmpty(j4, i4, k4))){ break label769; } } } double d3 = l2+0.5D-location.getY(); double d4 = d1*d1+d3*d3+d2*d2; if(d0 < 0.0D || d4 < d0){ d0 = d4; l = i2; i1 = l2+1; j1 = j2; k1 = k2%2; } } } } } } } int i5 = l; int j5 = i1; int j2 = j1; int k5 = k1%2; int l5 = 1-k5; if(k1%4 >= 2){ k5 = -k5; l5 = -l5; } ArrayList<Block> blocks = new ArrayList<Block>(); CraftWorld craftWorld = ((WorldServer)world).getWorld(); if(d0 < 0.0D){ if(i1 < 70){ i1 = 70; } if(i1 > 118){ i1 = 118; } j5 = i1; for(int l2 = -1; l2 <= 1; l2++){ for(int k2 = 1; k2 < 3; k2++){ for(int j3 = -1; j3 < 3; j3++){ int i3 = i5+(k2-1)*k5+l2*k5; int l3 = j5+j3; int k3 = j2+(k2-1)*l5-l2*k5; org.bukkit.block.Block b = craftWorld.getBlockAt(i3, l3, k3); if(!blocks.contains(b)){ blocks.add(b); } } } } } for(int l2 = 0; l2 < 4; l2++){ for(int k2 = 0; k2 < 4; k2++){ for(int j3 = -1; j3 < 4; j3++){ int i3 = i5+(k2-1)*k5; int l3 = j5+j3; int k3 = j2+(k2-1)*l5; org.bukkit.block.Block b = craftWorld.getBlockAt(i3, l3, k3); if(!blocks.contains(b)){ blocks.add(b); } } } } if(d0 < 0.0D){ if(i1 < 70){ i1 = 70; } if(i1 > 118){ i1 = 118; } j5 = i1; for(int l2 = -1; l2 <= 1; l2++){ for(int k2 = 1; k2 < 3; k2++){ for(int j3 = -1; j3 < 3; j3++){ int i3 = i5+(k2-1)*k5+l2*l5; int l3 = j5+j3; int k3 = j2+(k2-1)*l5-l2*k5; boolean flag = j3 < 0; world.setTypeId(i3, l3, k3, flag ? SOUL_SAND : 0); } } } } for(int l2 = 0; l2 < 4; l2++){ world.suppressPhysics = true; for(int k2 = 0; k2 < 4; k2++){ for(int j3 = -1; j3 < 4; j3++){ int i3 = i5+(k2-1)*k5; int l3 = j5+j3; int k3 = j2+(k2-1)*l5; boolean flag = (k2 == 0) || (k2 == 3) || (j3 == -1) || (j3 == 3); world.setTypeId(i3, l3, k3, flag ? SOUL_SAND : PORTAL); } } world.suppressPhysics = false; for(int k2 = 0; k2 < 4; k2++){ for(int j3 = -1; j3 < 4; j3++){ int i3 = i5+(k2-1)*k5; int l3 = j5+j3; int k3 = j2+(k2-1)*l5; world.applyPhysics(i3, l3, k3, world.getTypeId(i3, l3, k3)); } } } return true; } public TravelAgent setSearchRadius(int radius){ searchRadius = radius; return this; } public int getSearchRadius(){ return searchRadius; } public TravelAgent setCreationRadius(int radius){ creationRadius = radius < 2 ? 0 : radius-2; return this; } public int getCreationRadius(){ return creationRadius; } public boolean getCanCreatePortal(){ return canCreatePortal; } public void setCanCreatePortal(boolean create){ canCreatePortal = create; } } I am sorry if I am sounding like a noob because I am learning about plugin development and java so yea I am a noob with this.
Try importing craftbukkit alongside with the bukkit api, that should fix the net.minecraft errors i believe.
Yep I got both added as a external jar The error I get on console is .... Code: 22:57:04 [SEVERE] Could not load 'plugins\Halloween.jar' in folder 'plugins' org.bukkit.plugin.InvalidPluginException: java.lang.Error: Unresolved compilatio n problems: The import net.minecraft.server.World cannot be resolved The import org.bukkit.craftbukkit.CraftWorld cannot be resolved The import org.bukkit.event.block.BlockListener cannot be resolved BlockListener cannot be resolved to a type CraftWorld cannot be resolved to a type CraftWorld cannot be resolved to a type World cannot be resolved to a type The constructor PortalCreateEvent(Collection<Block>, World) is undefined CraftWorld cannot be resolved to a type CraftWorld cannot be resolved to a type World cannot be resolved to a type at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j ava:182) at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager. java:305) at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager .java:230) at org.bukkit.craftbukkit.v1_6_R3.CraftServer.loadPlugins(CraftServer.ja va:239) at org.bukkit.craftbukkit.v1_6_R3.CraftServer.<init>(CraftServer.java:21 7) at net.minecraft.server.v1_6_R3.PlayerList.<init>(PlayerList.java:56) at net.minecraft.server.v1_6_R3.DedicatedPlayerList.<init>(SourceFile:11 ) at net.minecraft.server.v1_6_R3.DedicatedServer.init(DedicatedServer.jav a:107) at net.minecraft.server.v1_6_R3.MinecraftServer.run(MinecraftServer.java :393) at net.minecraft.server.v1_6_R3.ThreadServerApplication.run(SourceFile:5 83) Caused by: java.lang.Error: Unresolved compilation problems: The import net.minecraft.server.World cannot be resolved The import org.bukkit.craftbukkit.CraftWorld cannot be resolved The import org.bukkit.event.block.BlockListener cannot be resolved BlockListener cannot be resolved to a type CraftWorld cannot be resolved to a type CraftWorld cannot be resolved to a type World cannot be resolved to a type The constructor PortalCreateEvent(Collection<Block>, World) is undefined CraftWorld cannot be resolved to a type CraftWorld cannot be resolved to a type World cannot be resolved to a type at bukkit.techguard.halloween.listeners.bListener.<init>(bListener.java: 6) at bukkit.techguard.halloween.Halloween.<init>(Halloween.java:26) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou rce) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j ava:178) ... 9 more I will display all the packages that are getting the error In the bukkit.techguard.halloween.listners bListener I get errors in the import net.minecraft.server.World; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.event.block.BlockListener; Code: package bukkit.techguard.halloween.listeners; import java.util.Collection; import java.util.HashSet; import net.minecraft.server.World; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; import org.bukkit.event.block.BlockListener; import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.world.PortalCreateEvent; import bukkit.techguard.halloween.Halloween; public class bListener extends BlockListener{ private Halloween plugin; public bListener(Halloween instance){ plugin = instance; } public void onBlockIgnite(BlockIgniteEvent ev){ if(ev.getCause() == IgniteCause.FLINT_AND_STEEL){ if(checkAndCreatePortal(((CraftWorld)ev.getBlock().getWorld()).getHandle(), ev.getBlock().getX(), ev.getBlock().getY(), ev.getBlock().getZ())){ ev.getBlock().setType(Material.PORTAL); ev.setCancelled(true); } } } public boolean checkAndCreatePortal(World world, int i, int j, int k){ byte b0 = 0; byte b1 = 0; int FIRE = Material.FIRE.getId(); int PORTAL = Material.PORTAL.getId(); int SOUL_SAND = Material.SOUL_SAND.getId(); if((world.getTypeId(i - 1, j, k) == SOUL_SAND) || (world.getTypeId(i + 1, j, k) == SOUL_SAND)) { b0 = 1; } if ((world.getTypeId(i, j, k - 1) == SOUL_SAND) || (world.getTypeId(i, j, k + 1) == SOUL_SAND)) { b1 = 1; } if (b0 == b1) { return false; } Collection<Block> blocks = new HashSet<Block>(); org.bukkit.World bworld = world.getWorld(); if (world.getTypeId(i - b0, j, k - b1) == 0) { i -= b0; k -= b1; } for (int l = -1; l <= 2; l++) { for (int i1 = -1; i1 <= 3; i1++) { boolean flag = (l == -1) || (l == 2) || (i1 == -1) || (i1 == 3); if (((l != -1) && (l != 2)) || ((i1 != -1) && (i1 != 3))) { int j1 = world.getTypeId(i + b0 * l, j + i1, k + b1 * l); if (flag) { if (j1 != SOUL_SAND) { return false; } blocks.add(bworld.getBlockAt(i + b0 * l, j + i1, k + b1 * l)); } else if ((j1 != 0) && (j1 != FIRE)) { return false; } } } } for(int l = 0; l < 2; l++) { for (int i1 = 0; i1 < 3; i1++) { blocks.add(bworld.getBlockAt(i + b0 * l, j + i1, k + b1 * l)); } } PortalCreateEvent event = new PortalCreateEvent(blocks, bworld); world.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return false; } world.suppressPhysics = true; for (int l = 0; l < 2; l++) { for (int i1 = 0; i1 < 3; i1++) { world.setTypeId(i + b0 * l, j + i1, k + b1 * l, PORTAL); } } world.suppressPhysics = false; return true; } public void onBlockPhysics(BlockPhysicsEvent ev){ Block b = ev.getBlock(); if(inPortal(((CraftWorld)b.getWorld()).getHandle(), b.getX(), b.getY(), b.getZ())){ ev.setCancelled(true); } if(b.getType() == Material.FIRE && b.getWorld().getName().equals("Halloween")){ ev.setCancelled(true); } } public boolean inPortal(World world, int i, int j, int k){ byte b0 = 0; byte b1 = 1; int PORTAL = Material.PORTAL.getId(); int SOUL_SAND = Material.SOUL_SAND.getId(); if ((world.getTypeId(i - 1, j, k) == PORTAL) || (world.getTypeId(i + 1, j, k) == PORTAL)) { b0 = 1; b1 = 0; } int i1; for (i1 = j; world.getTypeId(i, i1 - 1, k) == PORTAL; i1--); if (world.getTypeId(i, i1 - 1, k) != SOUL_SAND) { return false; } else { int j1; for (j1 = 1; (j1 < 4) && (world.getTypeId(i, i1 + j1, k) == PORTAL); j1++); if ((j1 == 3) && (world.getTypeId(i, i1 + j1, k) == SOUL_SAND)) { boolean flag = (world.getTypeId(i - 1, j, k) == PORTAL) || (world.getTypeId(i + 1, j, k) == PORTAL); boolean flag1 = (world.getTypeId(i, j, k - 1) == PORTAL) || (world.getTypeId(i, j, k + 1) == PORTAL); if ((flag) && (flag1)) return false; else if (((world.getTypeId(i + b0, j, k + b1) != SOUL_SAND) || (world.getTypeId(i - b0, j, k - b1) != PORTAL)) &&((world.getTypeId(i - b0, j, k - b1) != SOUL_SAND) || (world.getTypeId(i + b0, j, k + b1) != PORTAL))) return false; } else { return false; } } return true; } } In the eListener import org.bukkit.event.entity.EntityListener Code: package bukkit.techguard.halloween.listeners; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityListener; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import bukkit.techguard.halloween.Halloween; public class eListener extends EntityListener{ private Halloween plugin; public eListener(Halloween instance){ plugin = instance; } public void onCreatureSpawn(CreatureSpawnEvent ev) { if(!ev.getLocation().getWorld().getName().equals("Halloween")) return; switch(ev.getCreatureType()){ case CHICKEN: case COW: case PIG: case SHEEP: case SQUID: case WOLF: ev.setCancelled(true); break; default: break; } } public void onEntityDamage(EntityDamageEvent ev){ if(!ev.getEntity().getWorld().getName().equals("Halloween")) return; if(ev.getEntity() instanceof Player && ev.getCause() == DamageCause.FALL){ Player p = (Player)ev.getEntity(); if(p.getInventory().getHelmet().getType() == Material.GLASS){ ev.setCancelled(true); } } } } And this the pListener I get import org.bukkit.event.player.PlayerListener;import org.bukkit.craftbukkit.CraftChunk; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.block.CraftBlock; Code: package bukkit.techguard.halloween.listeners; import java.util.Random; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerListener; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerPortalEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; import org.bukkit.block.Block; import org.bukkit.block.Chest; import org.bukkit.craftbukkit.CraftChunk; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.block.CraftBlock; import bukkit.techguard.halloween.Halloween; import bukkit.techguard.halloween.PortalTravelAgent; import bukkit.techguard.halloween.Properties; public class pListener extends PlayerListener{ private Halloween plugin; public pListener(Halloween instance){ plugin = instance; } public void onPlayerPortal(PlayerPortalEvent ev){ Location from = ev.getPlayer().getLocation(); from.setY(from.getY()); if(plugin.bL.inPortal(((CraftWorld)from.getWorld()).getHandle(), from.getBlockX(), from.getBlockY(), from.getBlockZ()) || plugin.bL.inPortal( ((CraftWorld)from.getWorld()).getHandle(), from.getBlockX(), from.getBlockY()+1, from.getBlockZ())){ Location to = from; if(ev.getPlayer().getWorld().getName().equals("Halloween")){ to.setWorld(plugin.getServer().getWorlds().get(0)); from.setWorld(plugin.getServer().getWorlds().get(0)); } else { to.setWorld(plugin.getHalloweenWorld()); from.setWorld(plugin.getHalloweenWorld()); } ev.setPortalTravelAgent(new PortalTravelAgent()); ev.useTravelAgent(true); ev.setFrom(from); ev.setTo(to); } } public void onPlayerMove(PlayerMoveEvent ev){ if(!ev.getTo().getWorld().getName().equals("Halloween") || !Properties.GLASS_USE) return; if(ev.getPlayer().getInventory().getHelmet().getType() == Material.GLASS){ Location to = ev.getTo(); Location from = ev.getFrom(); if(from.getY()+0.2 < to.getY() && ev.getPlayer().getVelocity().getY() < 0.5){ ev.getPlayer().setVelocity(new Vector(0, 1, 0)); } } } @SuppressWarnings("deprecation") public void onPlayerInteract(PlayerInteractEvent ev){ Player p = ev.getPlayer(); ItemStack inHand = p.getItemInHand(); if(inHand != null && ev.getAction() == Action.RIGHT_CLICK_AIR){ Material block = inHand.getType(); if(block == Material.PUMPKIN || block == Material.JACK_O_LANTERN || block == Material.GLASS){ if(p.getInventory().getHelmet().getType() != Material.AIR) return; if(inHand.getAmount() == 1){ p.getInventory().setItemInHand(null); } else { inHand.setAmount(inHand.getAmount()-1); p.getInventory().setItemInHand(inHand); } p.getInventory().setHelmet(new ItemStack(inHand.getType(), 1)); p.updateInventory(); p.sendMessage("ยง6Happy Halloween!"); } } if(inHand != null && ev.getAction() == Action.RIGHT_CLICK_BLOCK){ Location location = ev.getClickedBlock().getLocation(); CraftWorld craftWorld = (CraftWorld)ev.getClickedBlock().getWorld(); Block block = new CraftBlock((CraftChunk) craftWorld.getChunkAt(location), location.getBlockX(), location.getBlockY(), location.getBlockZ()); block.setTypeId(craftWorld.getBlockTypeIdAt(location)); if(block.getType() == Material.CHEST && plugin.animator.chests.contains(ev.getClickedBlock().getLocation())){ Random rand = new Random(System.currentTimeMillis()); if(rand.nextInt(2) == 0){//treat Chest chest = (Chest)block.getState(); for(int i = 0; i < 24; i++){ ItemStack loot = getLoot(rand); if(loot != null){ craftWorld.dropItemNaturally(location, loot); } } block.setType(Material.AIR); chest.update(); } else {//trick Chest chest = (Chest)block.getState(); chest.getInventory().clear(); craftWorld.createExplosion(location, 4); } plugin.animator.unregisterChest(location); ev.setCancelled(true); ev.setUseInteractedBlock(org.bukkit.event.Event.Result.DENY); } } } private ItemStack getLoot(Random rand){ ItemStack loot = null; int item = rand.nextInt(100); if(rand.nextInt(6) != 0) return null; if(item <= 30){ loot = new ItemStack(Material.CAKE, 1); } else if(item <= 50){ loot = new ItemStack(Material.COOKIE, rand.nextInt(10)+1); } else if(item <= 80){ if(rand.nextInt(2) == 0){ loot = new ItemStack(Material.COOKED_CHICKEN, rand.nextInt(3)+1); } else { loot = new ItemStack(Material.COOKED_BEEF, rand.nextInt(3)+1); } } return loot; } } This package bukkit.techguard.halloween works I get errors HalloweenGenerator in the org.bukkit.craftbukkit.CraftWorld; Code: package bukkit.techguard.halloween.world; import java.util.Arrays; import java.util.List; import java.util.Random; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.ChunkGenerator; public class HalloweenGenerator extends ChunkGenerator { public byte[] generate(World world, Random rand, int x, int z){ byte[] blocks = new byte[32768]; for(int i = 0; i < 16; i++){ for(int k = 0; k < 16; k++){ int maxHeight = (int)(get((x*16)+i, (z*16)+k)*32)+30; int stoneLevel = maxHeight-rand.nextInt(7)-6; for(int j = maxHeight; j > 0; j--){ if(j == maxHeight && j > 35){ blocks[toByte(i, j, k)] = (byte)Material.GRASS.getId(); } else if(j == 1){ blocks[toByte(i, j, k)] = (byte)Material.BEDROCK.getId(); } else if(j <= stoneLevel){ blocks[toByte(i, j, k)] = (byte)Material.STONE.getId(); } else { blocks[toByte(i, j, k)] = (byte)Material.DIRT.getId(); } } if(maxHeight < 37){ ((CraftWorld)world).getHandle().suppressPhysics = true; for(int j = 36; j > 30; j--){ if(blocks[toByte(i, j, k)] == 0){ blocks[toByte(i, j, k)] = (byte)Material.STATIONARY_LAVA.getId(); } } ((CraftWorld)world).getHandle().suppressPhysics = false; } } } return blocks; } public double normalise(int x) { int conv = x % 360; if(conv >= 1) x = x % 360; return Math.toRadians(x); } public double get(int x, int z) { double calc = Math.sin(normalise(x/4)) +Math.sin(normalise(z/5)) +Math.sin(normalise(x-z)) +(Math.sin(normalise(z))/(Math.sin(normalise(z))+2))*2 +Math.sin(normalise((int) (Math.sin(normalise(x)+Math.sin(normalise(z)))+Math.sin(normalise(z))))+Math.sin(normalise(z/2)) +Math.sin(normalise(x) +Math.sin(normalise(z))) +Math.sin(normalise(z)) +Math.sin(normalise(z)) +Math.sin(normalise(x))) +Math.sin(normalise((x+z)/4)) +Math.sin(normalise((int) (x+Math.sin(normalise(z)*Math.sin(normalise(x)))))); calc = Math.abs(calc/6); if(calc>1) calc = 1; return calc; } public boolean canSpawn(World world, int x, int z) { return true; } public int toByte(int x, int y, int z){ return (x * 16 + z) * 128 + y; } public List<BlockPopulator> getDefaultPopulators(World world){ return Arrays.asList((BlockPopulator) new GravePopulator(), new ChestPopulator(), new PumpkinPopulator(), new TreePopulator(), new MushRoomPopulator(), new HolePopulator()/*, new SkullPopulator(), new GiantPumpkinPopulator()*/); } } And this PumpkinPopulator import net.minecraft.server.Block; import org.bukkit.craftbukkit.CraftWorld; Code: package bukkit.techguard.halloween.world; import java.util.Random; import net.minecraft.server.Block; import org.bukkit.Chunk; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.generator.BlockPopulator; public class PumpkinPopulator extends BlockPopulator{ private static final int PUMPKIN_CHANCE = 5; // Out of 200 public void populate(World world, Random rand, Chunk chunk) { if(rand.nextInt(200) <= PUMPKIN_CHANCE){ int y; for(y = 128; y > 0; y--) if(chunk.getBlock(chunk.getX(), y-1, chunk.getZ()).getTypeId() != 0) break; for(int i = 0; i < 128; i++){ int j = (chunk.getX()*16)+rand.nextInt(8)-rand.nextInt(8); int m = (chunk.getZ()*16)+rand.nextInt(8)-rand.nextInt(8); int k = y+rand.nextInt(4)-rand.nextInt(4); if(world.getBlockAt(j, k-1, m).getType() != Material.GRASS || (!Block.PUMPKIN.canPlace(((CraftWorld)world).getHandle(), j, k, m))) continue; int pumpkin = rand.nextInt(5) == 0 ? Material.JACK_O_LANTERN.getId() : Material.PUMPKIN.getId(); world.getBlockAt(j, k, m).setTypeIdAndData(pumpkin, (byte)rand.nextInt(4), false); } } } } And the 2 jar files I have are the bukkit-1.6.4-R0.1-20131007.183632-5.jar craftbukkit-1.6.4-R0.1-20131007.184737-6 (1).jar EDIT by Moderator: merged posts, please use the edit button instead of double posting.
winter4w What license is this plugin under? It may be illegal to just modify code and re-release it. But code from way back then should be scrapped and redone anyway.
I am not gonna re release it but I did talk to techguard and asked if I can try to update it and he said ok and send me the source in a email. I can show you that email if you want. I don't have plans posting it on bukkit but the main reason I want this is for the Halloween event on my server
I am wondering do you know what the org.bukkit.event.player.PlayerListener; and, import org.bukkit.craftbukkit.CraftWorld; have changed to because so far what I see the imports when I try to look for them in the bukkit jars they are not there so I am guessing they got changed.
Back in ye olde days, there were individual classes for Listeners by category. Today, we can listen to all events by implementing Listener. Also, I believe you had to specify individual events for what a class is listening for. Anyway, you should not use that code. Start fresh, or you'll take longer attempting to fix the incredibly broken code.
*sigh* I am not sure tho how to start it all off like I have made some plugins in the past for my server but never a world generator one. Is there any page that can make help me out with world generations ???
Ok I will try but what I herd was that world gen can be tricky. If anyone knows anything else let me know.