I would recommend starting off with something easier. If you are brand new to java and bukkit, a warp plugin probably isnt a good idea yet. But, just so you know, learn about schedulers (delayed task in this case), events (EntityDamageByEntityEvent), and you would probably have to make and save your own warps for this since essentials has its own way of doing it. Side note: args zero is reffering to the argument you put after the command (ex /hello <arg0> <arg1>) ps (im not sure if that's how you intended it to be)
1)Is the package that ClearInventory.java is in called clearinv.d0jo.yark? If not change the code to match the package. 3)Also add a } right at the bottom. 2)Also, for the warping. Unless you can hook directly into a plugin that has a warp event, just use a teleport event and check if the teleport cause is a plugin. EG: Code:java @EventHandlerpublic void Warp(PlayerTeleportEvent e){if(!(e.getCause()==TeleportCause.PLUGIN)){return;}//Has warped} Please bare in mind that that is untested and may not work ^.
elementalgodz11 args[0] refers to the argument after the first one, so: /warp spawn "spawn" would be args[0]. Use if(args.length == 0) - instead, as that refers to the first argument, which in this case would be "Warp"
elementalgodz11 if(cmd.getName().equalsIgnoreCase("warp) { doing if(args[0].equalsIgnoreCase("warp") { it would be like /command warp so if you wanted to list a warp, for example pvp: Code:java if(cmd.getName().equalsIgnoreCase("warp") {if(args.length == 0) {} else {if(args[0].equalsIgnoreCase("pvp") {p.getInventory().clear();p.getInventory().setArmorContents(null);}}}
elementalgodz11... "It gave me a bunch of errors" What errors? -.- I also told you how to do it. onCommand. elementalgodz11 onCommand that's what I coded it for, on your onCommand, so when they do it it clears when they do that warp, learn java before you start bukkit. elementalgodz11 Again, learn java.. Player p = (Player) sender; EDIT by Moderator: merged posts, please use the edit button instead of double posting.
In your main class(The one with onEnable and onDisable ) Put this in the onEnable method.. Code: void onEnable() { getCommand("warp").setExecutor(new onCommand()); info("plugin enabled"); }
I'm assuming you're also running essentials which is going to cause a command conflict with two plugins wanting to use the "warp" command, i would suggest using the CommandPreProcessEvent to listen for "/warp pvp"
To remove the potion effect do this: for (PotionEffect effect : player.getActivePotionEffects()){ player.removePotionEffect(effect.getType()); } Change the command for the warp. Maybe /go or something because /warp messes with essentials and make sure your plugin.yml is correct.
elementalgodz11 ... then do Code:java else if(args[0].equalsIgnoreCase("otherwarp") {//ect check if a sign has text when they click it, and clear their inv. add another command for /spawn.
Prepare for stupidity: Make a chat event and test for the commands Add Them to an array list Use async task of some sort and wait 3 seconds Check if they're in the array list and if they are clear their inv and remove them from the list On entity damage event check if the entity is a player and if they're in the array list If they are remove them
*****Sigh****** I know I was once like this but really, I had the common sense to know that I needed to know basic stuff before coming on here.
elementalgodz11 Or you could do: Code:java //playerchatblahString w = e.getMessage(); String[] args = w.split(" ");if(args[0].equalsIgnoreCase("warp") && args[1].equalsIgnoreCase("WARPNAME")) {inv.clear();//ect}else if(args[0].equalsIgnoreCase("spawn")) {inv.clear();} EDIT by Moderator: merged posts, please use the edit button instead of double posting.