[ERROR] HELP ME

Discussion in 'Plugin Development' started by giozadi, Jun 22, 2014.

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

    giozadi

    So guys, I have a minecraft server, and I'm doing plugins to server, the language is Java, but it is actually a little different because of bukkit programming: bukkit.org

    SOURCE MADE OF SCHEDULE:
    Code:
    me.eventozero2.com package;
     
    import java.io.File;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.logging.Logger;
     
     
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Location;
    import org.bukkit.block.Sign;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.EventPriority;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.Action;
    import org.bukkit.event.block.SignChangeEvent;
    import org.bukkit.event.entity.EntityDamageEvent;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.event.player.PlayerKickEvent;
    import org.bukkit.event.player.PlayerQuitEvent;
    import org.bukkit.plugin.java.JavaPlugin;
     
    @ SuppressWarnings ("unused")
    public class extends eventozero JavaPlugin implements Listener {
         
            public final Logger logger = Logger.getLogger ("Minecraft");
            private String group;
            public static Plugin eventozero;
            evento_aberto private boolean = false;
            evento_pvp private boolean = false;
            private List <Player> participants = new ArrayList <Player> ();
         
         
        public void OnDisable () {
         
        }
     
        public void OnEnable () {
            . getLogger () info ("Initializing EventoZero (V1.1.1) by giozadi");
            GetServer () getPluginManager () registerEvents (this, this)..;
        }
     
        @ EventHandler (priority = EventPriority.HIGHEST)
        private void NOM (PlayerQuitEvent e) {
            if (participantes.contains (e.getPlayer ())) {
                    GetServer () dispatchCommand (e.getPlayer (), "spawn").;
                    participantes.remove (e.getPlayer ());
                 
            }
        }
     
     
        @ EventHandler (priority = EventPriority.HIGHEST)
        private void onSChange (SignChangeEvent e) {
            if (e.getLine (0). equalsIgnoreCase ("[event]")) {
                    if (! e.getPlayer (). hasPermission ("evento.admin")) {
                            e.setCancelled (true);
                            . e.getPlayer () sendMessage (ChatColor.RED + "You can not create an Event card.");
                    }
                    else if (e.getLine (1). length () == 0) {
                            e.setCancelled (true);
                            . e.getPlayer () sendMessage (ChatColor.RED + "You did not enter the event name on the 2nd line.");
                    }
                    else if (e.getLine (2). length () == 0) {
                            e.setCancelled (true);
                            . e.getPlayer () sendMessage (ChatColor.RED + "You have not entered the premium event on the 3rd line.");
                    }
                    else
                            e.setLine (0, ChatColor.BLUE + "[EVENT]");
                            e.setLine (3 ChatColor.DARK_RED + "ZionPvP");
            }
        }
        @ EventHandler (priority = EventPriority.HIGHEST)
        private void onClick (PlayerInteractEvent e) {
            if (participantes.contains (e.getPlayer ()))
                    if (e.getAction () == Action.LEFT_CLICK_BLOCK | | e.getAction () == Action.RIGHT_CLICK_BLOCK)
                            if (e.getClickedBlock (). getState () instanceof Sign) {
                                    Board = sign (Sign) e.getClickedBlock () getState ().;
                                    if (placa.getLine (0). equalsIgnoreCase (ChatColor.BLUE + "[Event]")) {
                                            GetServer () broadcastMessage (".");
                                            GetServer () broadcastMessage ("§ d [Automatic Event] § d" + e.getPlayer () getName () + "won the event:"..);
                                            GetServer () broadcastMessage ("§ d [Automatic Event]" placa.getLine + (1) + "!").;
                                            GetServer () broadcastMessage (".");
                                            GetServer () broadcastMessage ("§ d [Automatic Event] § d" + e.getPlayer () getName () + "won the event:"..);
                                            GetServer () broadcastMessage ("§ d [Automatic Event]" placa.getLine + (1) + "!").;
                                            GetServer () broadcastMessage (".");
                                            GetServer () dispatchCommand (GetServer () getConsoleSender (), "eco green" + e.getPlayer () getName () + "" + placa.getLine (2)...);
                                            . e.getPlayer () sendMessage ("§ d [Automatic Event] § dVocê won" placa.getLine + (2) + "Coins for winning the event" placa.getLine + (1) + "!");
                                            GetServer () broadcastMessage (".");
                                            GetServer () broadcastMessage ("§ d [Automatic Event] END OF EVENT").;
                                            for (Player tp participants)
                                            GetServer () dispatchCommand (tp, "spawn").;
                                            participantes.clear ();
                                    }
                            }
        }
                   
        public boolean onCommand (CommandSender sender, Command command, String commandLabel, String [] args) {
            Player p = (sender == GetServer () getConsoleSender () null: (Player) sender.?);
         
                    if (command.getName (). equalsIgnoreCase ("event")) {
                            if (args.length == 0) {
                                    if (! evento_aberto) {
                                            if (p! = null)
    p.sendMessage ("§ 6 [ZionPvP] and § acontencendo No event at the moment!");
                                            else
                                                getLogger () info ("§ 6 [ZionPvP] and § acontencendo No event at the moment").;
                                            if (p.hasPermission ("eventozero.admin"))
                                                    if (p! = null)
                                                    p.sendMessage ("§ b [ZionPvP] § f / event <Start>");
                                                    else
                                                        getLogger () info ("§ b [ZionPvP] § f / <Start> event.");
                                            return true;
                                    }
                                    if (p! = null)
                                    p.sendMessage ("§ 6 [ZionPvP] § 6 You entered the Event");
                                    else
                                        getLogger () info ("§ 6 [ZionPvP] § 6 You entered the Event").;
                                    participantes.add (p);
                                    p.teleport (new Location (GetServer () getWorld ("world"), -139, 4, -212).);
                                    return true;
                            }
                            if (args [0] equalsIgnoreCase. ("start"))
                                    if (p.hasPermission ("eventozero.admin")) {
                                    if (args.length <6) {
                                            if (p! = null)
                                            p.sendMessage ("§ b [ZionPvP] § f / event start <event> <pvp[on/off]> <x> <z> <y>");
                                            else
                                                getLogger () info ("§ b [ZionPvP] § f / event start <event> <pvp[on/off]> <x> <z> <y>.");
                                            return true;
                                    }
                                    Nome_evento String = args [1];
                                    evento_pvp = false;
                                    if (args [2]. equalsIgnoreCase ("on")) {
                                            evento_pvp = true;
                                    }
                                    else if (! args [2]. equalsIgnoreCase ("off")) {
                                            if (p.hasPermission ("eventozero.admin"))
                                                    if (p! = null)
                                            p.sendMessage ("§ b [ZionPvP] § f / start event" + + nome_evento "<pvp[on/off]> <x> <z> <y>");
                                            else
                                                getLogger () info ("§ b [ZionPvP] § f / start event" + + nome_evento "<pvp[on/off]> <x> <z> <y>.");
                                            return true;
                                    }
                                    double x = 0;
                                    double y = 0;
                                    Double Z = 0;
                                    try {
                                            x = Double.parseDouble (args [3]);
                                            y = Double.parseDouble (args [4]);
                                            z = Double.parseDouble (args [5]);
                                    }
                                    catch (Exception e) {
                                         
                                    }
                                    evento_aberto = true;
                                    Preparing (nome_evento, evento_pvp, 5, x, y, z);
                                    return true;
                            }
                            else {
                                    if (p.hasPermission ("eventozero.admin"))
                                            if (p! = null)
                                    p.sendMessage ("§ b [ZionPvP] § f / event <Start> <pvp> <event>");
                                            else
                                                getLogger () info ("§ b [ZionPvP] § f / event <Start> <pvp> <event>.");
                                    return true;
                            }
                    }
                    return false;
        }
        private void prepare (final String nome_evento, final boolean pvp, final int times, final double x, final double y, final double z) {
            GetServer () broadcastMessage (ChatColor.LIGHT_PURPLE + "[Automatic Event] Event" nome_evento + + ".");
                    GetServer () broadcastMessage (ChatColor.LIGHT_PURPLE + "[Automatic Event] To join type / event ').;
                    GetServer () broadcastMessage (ChatColor.LIGHT_PURPLE + "[Automatic Event] This event is PVP: [" + (pvp "2ON § § d": "Coff § § d") + "]").;
                    GetServer () broadcastMessage (ChatColor.LIGHT_PURPLE + "[Automatic Event] Prize: 90k").;
     
                    GetServer (). getScheduler (). runTaskLater (this, new Runnable () {
                            public void run () {
                                    if (times> 0)
                                            Preparing (nome_evento, PVP-1 times x, y, z);
                                    else
                                            Start (nome_evento, PVP, x, y, z);
                            }
                    }, 400) ;/ / 20s
        }
        private void Start (final String nome_evento, final boolean pvp, final double x, final double y, final double z) {
            evento_aberto = false;
            . GetServer () broadcastMessage (ChatColor.LIGHT_PURPLE + "[Automatic Event] Event Started:" + nome_evento + "");
            if (nome_evento == "Spleef") {
                . GetServer () broadcastMessage (ChatColor.LIGHT_PURPLE + "[Automatic Event] This event is Spleef");
            Else {}
                . GetServer () broadcastMessage (ChatColor.LIGHT_PURPLE + "[Automatic Event] This event is not Spleef");
            }
            for (Player tp participants)
                    tp.teleport (new Location (GetServer (). getWorld ("world") / * world * /, x, y, z)) ;/ / aki is where it goes to TP (the venue)
    }
        }
    
    Until then, all right, now look at the line:

    Code:
    if (nome_evento == "Spleef") {
                . GetServer () broadcastMessage (ChatColor.LIGHT_PURPLE + "[Automatic Event] This event is Spleef");
            Else {}
                . GetServer () broadcastMessage (ChatColor.LIGHT_PURPLE + "[Automatic Event] This event is not Spleef");
    }

    Ok, but I test on my minecraft server all the time and when I start my event appears:
    This event is not Spleef
    however, I always note the name of the event: Spleef or Spleef Spleef or
    and always gives: This event is not Spleef.
    Help, thank you!
     
  2. Offline

    NoLiver92

    We know this bit, weve been doing it for a while :p


    Your error is here, you have too many brackets
    Code:java
    1. if (nome_evento == "Spleef") {
    2. . GetServer () broadcastMessage (ChatColor.LIGHT_PURPLE + "[Automatic Event] This event is Spleef");
    3. Else {}
    4. . GetServer () broadcastMessage (ChatColor.LIGHT_PURPLE + "[Automatic Event] This event is not Spleef");
    5. }


    change to this:
    Code:java
    1. if (nome_evento == "Spleef") {
    2. . GetServer () broadcastMessage (ChatColor.LIGHT_PURPLE + "[Automatic Event] This event is Spleef");
    3. }else {
    4. . GetServer () broadcastMessage (ChatColor.LIGHT_PURPLE + "[Automatic Event] This event is not Spleef");
    5. }
     
  3. Offline

    thecrystalflame

    That convention hurts my eyes :confused:
     
  4. Offline

    giozadi

    I do not understand how to solve, could explain me better?
     
  5. Offline

    dentych

    giozadi Looks to me like you have quite a lot of errors.
    Code:java
    1. . getLogger () info ("Initializing EventoZero (V1.1.1) by giozadi");

    Should be
    Code:java
    1. getLogger().info("blabla");

    And a lot of other cases of wrongly placed punctuation, wrongly placed brackets, etc..

    Go through this: http://docs.oracle.com/javase/tutorial/ before jumping into the Bukkit API :)
     
  6. Offline

    NoLiver92


    You need to look at the if statement cant compare it to this: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/if.html

    All your synatx, punctuation and layout of your code is wrong, You really need to learn Java before starting the BukkitAPI!!!! This is the same as Dentych said above, follow the link he pasted to learn or google theNewBoston - they have excellent videos on java to follow.
     
  7. NoLiver92 Did you actually look at that code before trying to correct it? o.o
     
  8. Offline

    NoLiver92

    Ohh yeah I did but i missed a closed bracket before the else, updated it
     
  9. NoLiver92 I was more wondering at the fact that you object to one instance of misplaced brackets but are completely fine with the abundance of syntax errors, as well as comparing Strings with == :)
     
    L33m4n123 likes this.
  10. Offline

    NoLiver92


    I know they are there but he asked us to look at certian lines as it wasnt working, i was answering his specific question he asked for help on. Because on the big block of coding he said that was alright the error was in the next bit he posted, hence the answer on that part
     
  11. NoLiver92 OH right, I missed that point. Although it doesn't change the fact that, within the same code segment, there are syntax errors and String == String comparisons. Although I have to admit that the syntax errors are more likely to be that the clipboard was involved in a tragic accident IDE -> Forums
     
  12. Offline

    NoLiver92

    AdamQpzm well Dont go jumping to conclusions to have a go at someone/point out all of their mistakes!!! I agree if he used the correct formatting on bukkit he wouldnt have so many syntax errors but that is easy to spot what hes done with it and the code will work.

    giozadi Istead of using "==" to compare strings use this: ".equalsIgnoreCase("Spleef")".
     
  13. What do you mean? Having a go at who? Pointing out whose mistakes?
     
  14. Offline

    NoLiver92

    making a comment like this:
    You didnt add anything constructive to the thread and were having a go at my mistake rather then helping the OP get the answer they were after (yes i made a mistake so does everyone). You tried to point out my mistakes and you didnt even read the original post correctly yourself - you saw my error and decided to comment on that making yourself look like an ass.
     
  15. NoLiver92 I'm sorry you took it that way, that wasn't how I intended my post to seem. And for the record, if that paste in the OP matched the code, then there's no point in trying to help them, as they'd need to learn Java first.
     
Thread Status:
Not open for further replies.

Share This Page