Solved SignChange Event Countdown?!

Discussion in 'Plugin Help/Development/Requests' started by JustThiemoo, Feb 6, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    JustThiemoo

    Hey people.
    I got another question, and again its about signs.
    (Anyting wrong in the code, tell it, im kinda new in Bukkit Development)
    Code:
    @EventHandler(priority = EventPriority.HIGHEST)
        public void onSignClickSafehouseBuy(PlayerInteractEvent e) {
            Player p = e.getPlayer();
            if (e.getAction() != Action.RIGHT_CLICK_BLOCK) {
                return;
            }
            if (!(e.getClickedBlock().getState() instanceof Sign)) {
                return;
            }
            final Sign sign = (Sign) e.getClickedBlock().getState();
            if (sign.getLine(1).equalsIgnoreCase("SafeHouse 1")) {
                if (p.hasPermission("donutpvp.safehouse.sh1")) {
                    Location loc = new Location(Bukkit.getServer().getWorld(
                            this.World), this.SH1X, this.SH1Y, this.SH1Z,
                            this.SH1Yaw, this.SH1Pitch);
    
                    p.teleport(loc);
                    p.sendRawMessage(cmdmessage + this.SHEnter);
                } else {
                    if (p.getLevel() >= 50) {
                        sign.setLine(0, ChatColor.DARK_RED + "" + ChatColor.BOLD
                                + "[SafeHouse]");
                        sign.setLine(1, "SafeHouse 1");
                        sign.setLine(2, "24H");
                        sign.setLine(3, p.getName());
                        sign.update();
                        p.sendMessage(cmdmessage + this.SHBuy);
                        // Run Countdown. Start from 24 hours, to 0 Hours and 0 Minutes update sign every 10 minutes.
    
                       
    }}}}
    
    I'm making a SafeHouse extensions for KitPvP, buy i dont know how to let the "24H" change every 10 minutes, to "23H - 50M, 23H - 40M, etc...."
    Is this possible, if it is, how to do it.
    I want the countdown to start after a Player Bought it.

    Please can anyone help me, i need this!
     
  2. Offline

    Lolmewn

    Use a Scheduler and let it run every 10 minutes (so that's 10 * 60 * 20 ticks).
     
  3. Offline

    JustThiemoo

    I already did something like that, but that didnt work because i forgot to put sign.Update(); after the schedule, but it works now, so this topic can be closed.
     
  4. @JustThiemoo If you would like it locked you can report the OP requesting a lock.
     
Thread Status:
Not open for further replies.

Share This Page