Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8842067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:52:21+00:00 2026-06-14T10:52:21+00:00

Hey I have small problem but I can’t fix it :( I use mysql

  • 0

Hey I have small problem but I can’t fix it 🙁 I use mysql + bukkit libraries, and when I want use one of the methods I get error of unreachable code

Main.java

package Hester.CrafMe;

import java.util.logging.Logger;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin {

    protected static final Logger log=Logger.getLogger("Minecraft");
    private static final String ALPHA_NUM = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    public Colorizer colorize = new Colorizer();
    public MySQL sql = new MySQL();
    public static Main plugin;



public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
            final FileConfiguration config = this.getConfig();
            Player player = (Player) sender;
            int LANG = config.getInt("PlayerConfig."+player.getName()+".language");

        //uKEY(unikalny kod)
        if (command.getName().equalsIgnoreCase("ukey")){
            String Private_uKEY = uKEY(7);

            if(LANG == 1){
                player.sendMessage(ChatColor.RED + "Twoj unikalny kod to: "+ ChatColor.YELLOW + Private_uKEY);
                player.sendMessage(ChatColor.RED + "Podany kod wpisz na stronie "+ ChatColor.YELLOW + "www.crafme.net");        
                return true;
            } else {
                player.sendMessage(ChatColor.RED + "Your unique code is: "+ ChatColor.YELLOW + Private_uKEY);
                player.sendMessage(ChatColor.RED + "Enter the code on the page "+ ChatColor.YELLOW + "www.crafme.net");
                return true;
            }

            sql.uKEY(Private_uKEY, player.getName());
        }

        return false;
    }

}

MySQL.java and here i connect to sql but i have problem with unreachable code

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Date;

import org.bukkit.event.Listener;

public class MySQL implements Listener {
    private Connection connect = null;
    private Statement statement = null;
    private PreparedStatement preparedStatement = null;
    private ResultSet resultSet = null;

  public void connect() throws Exception {
      try {
          Class.forName("com.mysql.jdbc.Driver");
          connect = DriverManager.getConnection("jdbc:mysql://localhost....?"+ "user=test&password=whatever");
          statement = connect.createStatement();

          ... more code

      } catch (Exception e) {
          throw e;
      } finally {
          close();
      }
  }

what is wrong ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:52:23+00:00Added an answer on June 14, 2026 at 10:52 am

    You really need to point out where are you getting the unreachable code message. With the current information all we can do is guesswork.

    Still, some examples of common dead code cases are

    public String getProperty() {
        return "property";
        System.out.println("Dead code"); //Code after a return statement
    }
    

    or

    //Method...
    throw new Exception();
    //Unreachable code from now on, after an exception is thrown.
    

    In this case, you have an if and its else both returning a value, hence the code after those statements won’t be executed.

    if (command.getName().equalsIgnoreCase("ukey")){
        String Private_uKEY = uKEY(7);
        if(LANG == 1){
            player.sendMessage(ChatColor.RED + "Twoj unikalny kod to: "+ ChatColor.YELLOW + Private_uKEY);
            player.sendMessage(ChatColor.RED + "Podany kod wpisz na stronie "+ ChatColor.YELLOW + "www.crafme.net");        
            return true; //Returning a value
        } else {
            player.sendMessage(ChatColor.RED + "Your unique code is: "+ ChatColor.YELLOW + Private_uKEY);
            player.sendMessage(ChatColor.RED + "Enter the code on the page "+ ChatColor.YELLOW + "www.crafme.net");
            return true; //Returning a value on the else too
        }
        //Since both the if and the else return something, the code below won't be executed.
        sql.uKEY(Private_uKEY, player.getName()); 
    
    }
    
    return false;
    

    You need to work on what do you want to do there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey I have downloaded one of the xml editors from some site. But don't
Hey there, I have a small problem with compiling and linking with the command
hey I have a small problem with my rake class CreateEvents < ActiveRecord::Migration def
Hey I have a small problem doing a query: the query line is: Query
Hey guys, I have developed a small site that i would like to embed
for example: I have a string in the resources: <string name="smth"><small>hey girls</small></string> When I
Hey I have a problem comparing the value of a CGPoint (struct with two
Hey guys, sorry I'm kind of new to programming, but I had a small
hey guys i have written a small webservice which allows users of a company
Hey I have coded CakePHP for a number of things but never ran into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.