Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.mcluke300.ratemybuild;
- import org.bukkit.Bukkit;
- import org.bukkit.Material;
- import org.bukkit.block.Block;
- import org.bukkit.block.Sign;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.block.SignChangeEvent;
- import org.bukkit.plugin.java.JavaPlugin;
- public class ratemybuild extends JavaPlugin implements Listener{
- public static ratemybuild plugin;
- @Override
- public void onEnable() {
- plugin = this;
- LoadConfiguration();
- Bukkit.getServer().getPluginManager().registerEvents(this, this);
- }
- @Override
- public void onDisable() {
- }
- @EventHandler
- public void onSign(SignChangeEvent e) {
- String[] lines = e.getLines();
- System.out.print("hi");
- if (lines[0].equalsIgnoreCase("[RateMyBuild]")) {
- System.out.print("hi");
- if (e.getPlayer().hasPermission("RateMyBuild.MakeSign")) {
- System.out.print("hi");
- e.setLine(1, e.getPlayer().getName());
- e.setLine(2, "0");
- e.setLine(3, "[ -0 / +0 ]");
- Sign sign = (Sign) e.getBlock().getState();
- sign.update();
- int xx = (int) sign.getLocation().getX();
- int yy = (int) sign.getLocation().getY();
- int zz = (int) sign.getLocation().getZ();
- Block block1 = e.getPlayer().getWorld().getBlockAt(xx+1, yy, zz);
- Block block2 = e.getPlayer().getWorld().getBlockAt(xx-1, yy, zz);
- block1.setType(Material.SIGN_POST);
- block2.setType(Material.SIGN_POST);
- Sign sign1 = (Sign) block1.getState();
- Sign sign2 = (Sign) block2.getState();
- sign1.setLine(1, "+1");
- sign2.setLine(1, "-1");
- sign1.setData(sign.getData());
- sign2.setData(sign.getData());
- sign1.update();
- sign2.update();
- System.out.print("hi");
- }
- }
- }
- public void LoadConfiguration() {
- String path = "BlockedCommands";
- getConfig().addDefault(path, path);
- getConfig().options().copyDefaults(true);
- saveConfig();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement