String Split Help

Discussion in 'Spigot Plugin Development' started by top2001, Jul 1, 2015.

  1. Hello everyone, I am having some issues with checking if a string split is the player name. The code is below. If anyone could help me with this, it'd be much appreciated :)

    PS: The broadcast messages are just for debugging. The last debug message I get when I place the block is "Looping Quarrys". I also do not get any errors.

    Code (Text):
    @EventHandler
        public void onPlace(BlockPlaceEvent e) {
            String prefix = this.getConfig().getString("Prefix").replaceAll("&", "ยง");
            Player player = (Player) e.getPlayer();
            if(e.getBlock().getType().equals(Material.getMaterial(519))) {
                Bukkit.broadcastMessage("Quarry detected");
                boolean ignoreHeight = true;
                Claim cachedClaim = null;
                Claim claim = GriefPrevention.instance.dataStore.getClaimAt(e.getBlock().getLocation(), ignoreHeight, cachedClaim);
                try {
                    if(claim.getOwnerName().equals(player.getName())) {
                        List<String> quarrys = quarrydata.getStringList("QuarryData");
                        for(String quarryList : quarrys) {
                            Bukkit.broadcastMessage("Looping quarrys");
                            String[] quarryListSplit = quarryList.split(",");
                            String XString = quarryListSplit[0];
                            String YString = quarryListSplit[1];
                            String ZString = quarryListSplit[2];
                            String WorldString = quarryListSplit[3];
                            String PlayerString = quarryListSplit[4];
                            String RunningString = quarryListSplit[5];
                            String TimeString = quarryListSplit[6];
                           
                            int X = Integer.parseInt(XString);
                            int Y = Integer.parseInt(YString);
                            int Z = Integer.parseInt(ZString);
                            String World = String.valueOf(WorldString);
                            String Player = String.valueOf(PlayerString);
                            int Running = Integer.parseInt(RunningString);
                            int Time = Integer.parseInt(TimeString);
                           
                            if(player.getName() == Player) {
                                Bukkit.broadcastMessage("Player found");
                                if(X == e.getBlock().getX() && (Y == e.getBlock().getY()) && (Z == e.getBlock().getZ()) && (World == e.getBlock().getWorld().getName())) {
                                    Bukkit.broadcastMessage("Coords correct");