Update Signs Source!!!

Discussion in 'Nukkit discussions and help' started by LucGamesHD, 11/2/16.

  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice
We welcome you on our site. This site is devoted to the Nukkit project and all that is connected with him. Here you can communicate, download plugins, also many other things get acquainted! Register the account right now :3
  1. LucGamesHD

    LucGamesHD Developer

    Messages:
    26
    Likes Received:
    10
    Minecraft:
    LucGamesYT
    Hey i have found a method to update signs !
    for example SurvivalGames signs or other things!
    and sorry for my english
    :)
    Code:
    import cn.nukkit.blockentity.BlockEntitySign;
    import cn.nukkit.level.Level;
    import cn.nukkit.math.Vector3;
    import cn.nukkit.scheduler.PluginTask;
    import de.lucgameshd.gungame.GunGame;
    public class SignUpdate extends PluginTask<GunGame> {
    GunGame pl;
    Level level;
    
    [pre][code]public SignUpdate(GunGame owner, Level level) {
        super(owner);
        this.owner = pl;
        this.level = level;
    }
    
    @Override
    public void onRun(int arg0) {
    if(level instanceof Level){
        int players = level.getPlayers().size();
    
        if(level.getBlockEntity(new Vector3(142, 70, 131)) instanceof BlockEntitySign){
            BlockEntitySign s = (BlockEntitySign) level.getBlockEntity(new Vector3(142, 70, 131));
            if(s.getText()[0].equalsIgnoreCase("[GunGame]")){
                s.setText("[GunGame]", players + "/25");
            }
        }
    
    }
    
    }
    [/pre]
    }
    [/code]
     
    fromgate likes this.
  2. fromgate

    fromgate Administrator

    Messages:
    665
    Likes Received:
    186
    Great! Thank you! :)
     

Share This Page