Advertisement
Guest User

Untitled

a guest
Jul 24th, 2012
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.90 KB | None | 0 0
  1. package me.mcluke300.ratemybuild;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.Material;
  5. import org.bukkit.block.Block;
  6. import org.bukkit.block.Sign;
  7. import org.bukkit.event.EventHandler;
  8. import org.bukkit.event.Listener;
  9. import org.bukkit.event.block.SignChangeEvent;
  10. import org.bukkit.plugin.java.JavaPlugin;
  11.  
  12. public class ratemybuild extends JavaPlugin implements Listener{
  13.  
  14.     public static ratemybuild plugin;
  15.     @Override
  16.     public void onEnable() {
  17.         plugin = this;
  18.         LoadConfiguration();
  19.         Bukkit.getServer().getPluginManager().registerEvents(this, this);
  20.     }
  21.     @Override
  22.     public void onDisable() {
  23.     }
  24.  
  25.  
  26.     @EventHandler
  27.     public void onSign(SignChangeEvent e) {
  28.         String[] lines = e.getLines();
  29.         System.out.print("hi");
  30.         if (lines[0].equalsIgnoreCase("[RateMyBuild]")) {
  31.             System.out.print("hi");
  32.             if (e.getPlayer().hasPermission("RateMyBuild.MakeSign")) {
  33.                 System.out.print("hi");
  34.                 e.setLine(1, e.getPlayer().getName());
  35.                 e.setLine(2, "0");
  36.                 e.setLine(3, "[ -0 / +0 ]");
  37.             Sign sign = (Sign) e.getBlock().getState();
  38.             sign.update();
  39.             int xx = (int) sign.getLocation().getX();
  40.             int yy = (int) sign.getLocation().getY();
  41.             int zz = (int) sign.getLocation().getZ();
  42.             Block block1 = e.getPlayer().getWorld().getBlockAt(xx+1, yy, zz);
  43.             Block block2 = e.getPlayer().getWorld().getBlockAt(xx-1, yy, zz);
  44.             block1.setType(Material.SIGN_POST);
  45.             block2.setType(Material.SIGN_POST);
  46.             Sign sign1 = (Sign) block1.getState();
  47.             Sign sign2 = (Sign) block2.getState();
  48.             sign1.setLine(1, "+1");
  49.             sign2.setLine(1, "-1");
  50.             sign1.setData(sign.getData());
  51.             sign2.setData(sign.getData());
  52.             sign1.update();
  53.             sign2.update();
  54.             System.out.print("hi");
  55.             }
  56.            
  57.         }
  58.  
  59.     }
  60.  
  61.    
  62.     public void LoadConfiguration() {
  63.         String path = "BlockedCommands";
  64.         getConfig().addDefault(path, path);
  65.         getConfig().options().copyDefaults(true);
  66.         saveConfig();
  67.  
  68.     }
  69.  
  70.  
  71.  
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement