Jump to content

Recommended Posts

Posted

Hi guys,

so i was making a plugin for tekkit new frontier (Minecraft 1.5.1) and i exported it, put it in the plugins folder and started up the server. When i log into the server "/antibag" works but when i do something in my inventory or try and rename the bag the plugin doesn't do anything. I can't seem to work out what the problem is, so i decided to ask u guys :)

Here is my main class:

Code:java

  1. package me.CookieAssassin.AntiBag;


  2. import java.util.logging.Logger;

  3. import org.bukkit.command.Command;
  4. import org.bukkit.command.CommandSender;
  5. import org.bukkit.entity.Player;
  6. import org.bukkit.event.Event;
  7. import org.bukkit.plugin.PluginDescriptionFile;
  8. import org.bukkit.plugin.PluginManager;
  9. import org.bukkit.plugin.java.JavaPlugin;

  10. public class AntiBag extends JavaPlugin{

  11. public final Logger logger= Logger.getLogger("Minecraft");
  12. public static AntiBag plugin;
  13. public final KeyPressListener kpl = new KeyPressListener(this);

  14. @Override
  15. public void onDisable()
  16. {
  17. PluginDescriptionFile pdfFile = this.getDescription();
  18. this.logger.info(pdfFile.getName() + " Has Been Disabled!");
  19. }

  20. @Override
  21. public void onEnable()
  22. {
  23. PluginManager pm = getServer().getPluginManager();
  24. pm.registerEvents(this.kpl, this);

  25. PluginDescriptionFile pdfFile = this.getDescription();
  26. this.logger.info(pdfFile.getName() + " V." + pdfFile.getVersion() + " Has Been Enabled!");
  27. }

  28. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String args[])
  29. {
  30. Player harvey = (Player) sender;


  31. if(commandLabel.equalsIgnoreCase("antibag"))
  32. {
  33. sender.sendMessage("§4[§1AntiBag§4] This plugin is for tekkit new frontier Minecraft version 1.5.1. It stops users from duplicating using backpacks.");
  34. }
  35. return false;
  36. }
  37. }

And here is my KeyPressListeners class:

Code:java

  1. package me.CookieAssassin.AntiBag;

  2. import net.minecraft.server.v1_5_R3.Material;

  3. import org.bukkit.entity.Player;
  4. import org.bukkit.event.EventHandler;
  5. import org.bukkit.event.EventPriority;
  6. import org.bukkit.event.Listener;
  7. import org.bukkit.event.block.Action;
  8. import org.bukkit.event.inventory.InventoryInteractEvent;
  9. import org.bukkit.event.player.PlayerInteractEvent;

  10. import backpack.Backpack;
  11. import backpack.misc.ConfigurationBackpack;
  12. import backpack.util.*;

  13. public class KeyPressListener implements Listener
  14. {
  15. AntiBag plugin;

  16. public KeyPressListener(AntiBag instance)
  17. {
  18. plugin = instance;
  19. }

  20. @EventHandler(priority=EventPriority.LOWEST, ignoreCancelled=true)
  21. private void click(InventoryInteractEvent event)
  22. {
  23. Player player = (Player) event.getViewers();
  24. String eventName = event.getEventName();
  25. player.sendMessage("§4[§1AntiBag§4] The event you just called is " + eventName);
  26. }

  27. @EventHandler(priority=EventPriority.LOWEST, ignoreCancelled=true)
  28. private void bitchTryingToRename(PlayerInteractEvent event)
  29. {
  30. String eventName = event.getEventName();
  31. Player player = event.getPlayer();
  32. if(event.getPlayer().getItemInHand().getType().getId()==5857 && player.isSneaking() && (event.getAction().equals(Action.RIGHT_CLICK_AIR)||event.getAction().equals(Action.RIGHT_CLICK_BLOCK)))
  33. {
  34. event.setCancelled(true);
  35. player.sendMessage("§4[§1AntiBag§4] Renaming backpacks has been disabled");
  36. }
  37. player.sendMessage("§4[§1AntiBag§4] The event you just called is " + eventName);
  38. }

  39. }

Eclipse isn't coming up with any errors.

I would be very grateful if someone could tell me what i'm doing wrong.

Posted

Moved this to mod makers market since it's a help request not a mod idea.

I haven't touched bukkit myself, but there are others on the forum who have. Hopefully someone can pick out the problem.

Posted

Moved this to mod makers market since it's a help request not a mod idea.

I haven't touched bukkit myself, but there are others on the forum who have. Hopefully someone can pick out the problem.

Thank you for moving it.

I made a post on bukkit forums but there staff just removed the thread and told me to put it here. I really don't know why myself, its the same as any other bukkit plugin.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...