Search in sources :

Example 16 with Builder

use of com.alpsbte.plotsystem.core.system.Builder in project Plot-System by AlpsBTE.

the class SelectLanguageMenu method setPreviewItems.

@Override
protected void setPreviewItems() {
    super.setPreviewItems();
    builder = new Builder(getMenuPlayer().getUniqueId());
    isAutoDetectEnabled = builder.getLanguageTag() == null;
}
Also used : Builder(com.alpsbte.plotsystem.core.system.Builder) LoreBuilder(com.alpsbte.plotsystem.utils.items.builder.LoreBuilder) ItemBuilder(com.alpsbte.plotsystem.utils.items.builder.ItemBuilder)

Example 17 with Builder

use of com.alpsbte.plotsystem.core.system.Builder in project Plot-System by AlpsBTE.

the class CMD_Plot_Teleport method onCommand.

@Override
public void onCommand(CommandSender sender, String[] args) {
    try {
        if (getPlayer(sender) != null) {
            if (args.length > 0 && Utils.TryParseInt(args[0]) != null) {
                int plotID = Integer.parseInt(args[0]);
                Plot plot;
                if (PlotManager.plotExists(plotID) && (plot = new Plot(plotID)).getStatus() != Status.unclaimed) {
                    plot.getWorld().teleportPlayer(getPlayer(sender));
                } else {
                    if (sender.hasPermission("plotsystem.admin") && PlotManager.plotExists(plotID)) {
                        new DefaultPlotGenerator(new Plot(plotID), new Builder(getPlayer(sender).getUniqueId()));
                    } else {
                        sender.sendMessage(Utils.getErrorMessageFormat(LangUtil.get(sender, LangPaths.Message.Error.PLOT_DOES_NOT_EXIST)));
                    }
                }
            } else {
                sendInfo(sender);
            }
        } else {
            Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "This command can only be used as a player!");
        }
    } catch (SQLException ex) {
        sender.sendMessage(Utils.getErrorMessageFormat(LangUtil.get(sender, LangPaths.Message.Error.ERROR_OCCURRED)));
        Bukkit.getLogger().log(Level.SEVERE, "A SQL error occurred!", ex);
    }
}
Also used : SQLException(java.sql.SQLException) Plot(com.alpsbte.plotsystem.core.system.plot.Plot) Builder(com.alpsbte.plotsystem.core.system.Builder) DefaultPlotGenerator(com.alpsbte.plotsystem.core.system.plot.generator.DefaultPlotGenerator)

Aggregations

Builder (com.alpsbte.plotsystem.core.system.Builder)17 SQLException (java.sql.SQLException)12 ItemBuilder (com.alpsbte.plotsystem.utils.items.builder.ItemBuilder)9 LoreBuilder (com.alpsbte.plotsystem.utils.items.builder.LoreBuilder)9 ResultSet (java.sql.ResultSet)5 CityProject (com.alpsbte.plotsystem.core.system.CityProject)4 Plot (com.alpsbte.plotsystem.core.system.plot.Plot)4 PlotDifficulty (com.alpsbte.plotsystem.utils.enums.PlotDifficulty)4 Status (com.alpsbte.plotsystem.utils.enums.Status)4 ExecutionException (java.util.concurrent.ExecutionException)4 Level (java.util.logging.Level)4 Bukkit (org.bukkit.Bukkit)4 Player (org.bukkit.entity.Player)4 ItemStack (org.bukkit.inventory.ItemStack)4 Review (com.alpsbte.plotsystem.core.system.Review)3 Slot (com.alpsbte.plotsystem.utils.enums.Slot)3 LangUtil (com.alpsbte.plotsystem.utils.io.language.LangUtil)3 PlotSystem (com.alpsbte.plotsystem.PlotSystem)2 DatabaseConnection (com.alpsbte.plotsystem.core.database.DatabaseConnection)2 DefaultPlotGenerator (com.alpsbte.plotsystem.core.system.plot.generator.DefaultPlotGenerator)2