Finished setup command.

This commit is contained in:
Jesse Boyd 2014-10-11 12:09:14 -07:00
parent a6375796c0
commit 6c1527f41c
4 changed files with 377 additions and 205 deletions

View File

@ -40,198 +40,200 @@ public enum C {
"&cStep &6%s&c: %s &c<Expecting: &6%s&c, Default: &6%s&c>"), SETUP_INVALID_ARG( "&cStep &6%s&c: %s &c<Expecting: &6%s&c, Default: &6%s&c>"), SETUP_INVALID_ARG(
"&c%s is not a valid argument for step %s. To cancel setup use: /plot setup cancel"), SETUP_VALID_ARG( "&c%s is not a valid argument for step %s. To cancel setup use: /plot setup cancel"), SETUP_VALID_ARG(
"&cValue &6%s &cset for step %s"), SETUP_FINISHED( "&cValue &6%s &cset for step %s"), SETUP_FINISHED(
"&cFinished setup for world &c%s.\n&4If you are using MULTIVERSE or MULTIWORLD you will need to import this world. Otherwise you will need to add this world to the 'bukkit.yml' file (See installation tutorial for more info)"), SETUP_WORLD_TAKEN( "&cFinished setup for world &c%s.\n&4If you are using MULTIVERSE or MULTIWORLD the world should have just been created. Otherwise you will need to add the world manually through the bukkit.yml"), SETUP_WORLD_TAKEN(
"&c%s is already a registered plotworld"), SETUP_MISSING_WORLD( "&c%s is already a registered plotworld"), SETUP_MISSING_WORLD(
"&cYou need to specify a world name (&6/p setup {world}&c)\n&6Additional commands:\n&c - &6/p setup <value>\n&c - &6/p setup back\n&c - &6/p setup cancel"), "&cYou need to specify a world name (&6/p setup &l{world}&6 {generator}&c)\n&6Additional commands:\n&c - &6/p setup <value>\n&c - &6/p setup back\n&c - &6/p setup cancel"), SETUP_MISSING_GENERATOR(
/* "&cYou need to specify a generator (&6/p setup {world} &l{generator}&r&c)\n&6Additional commands:\n&c - &6/p setup <value>\n&c - &6/p setup back\n&c - &6/p setup cancel"), SETUP_INVALID_GENERATOR(
* Schematic Stuff "&cIncalid generator. Possible options: %generators%"),
*/ /*
SCHEMATIC_MISSING_ARG( * Schematic Stuff
*/
SCHEMATIC_MISSING_ARG(
"&cYou need to specify an argument. Possible values: &6test {name}"), SCHEMATIC_INVALID( "&cYou need to specify an argument. Possible values: &6test {name}"), SCHEMATIC_INVALID(
"&cThat is not a valid schematic. Reason: &c%s"), SCHEMATIC_VALID( "&cThat is not a valid schematic. Reason: &c%s"), SCHEMATIC_VALID(
"&cThat's a valid schematic"), SCHEMATIC_PASTE_FAILED( "&cThat's a valid schematic"), SCHEMATIC_PASTE_FAILED(
"&cFailed to paste schematic"), SCHEMATIC_PASTE_SUCCESS( "&cFailed to paste schematic"), SCHEMATIC_PASTE_SUCCESS(
"&cSchematic pasted successfully"), "&cSchematic pasted successfully"),
/* /*
* Title Stuff * Title Stuff
*/ */
TITLE_ENTERED_PLOT("You entered plot %s"), TITLE_ENTERED_PLOT_COLOR("GOLD"), TITLE_ENTERED_PLOT_SUB( TITLE_ENTERED_PLOT("You entered plot %s"), TITLE_ENTERED_PLOT_COLOR("GOLD"), TITLE_ENTERED_PLOT_SUB(
"Owned by %s"), TITLE_ENTERED_PLOT_SUB_COLOR("RED"), TITLE_LEFT_PLOT( "Owned by %s"), TITLE_ENTERED_PLOT_SUB_COLOR("RED"), TITLE_LEFT_PLOT(
"You entered plot %s"), TITLE_LEFT_PLOT_COLOR("GOLD"), TITLE_LEFT_PLOT_SUB( "You entered plot %s"), TITLE_LEFT_PLOT_COLOR("GOLD"), TITLE_LEFT_PLOT_SUB(
"Owned by %s"), TITLE_LEFT_PLOT_SUB_COLOR("RED"), "Owned by %s"), TITLE_LEFT_PLOT_SUB_COLOR("RED"),
/* /*
* Core Stuff * Core Stuff
*/ */
PREFIX("&c[&6&lPlot&c] "), ENABLED("&6Plots are now enabled"), EXAMPLE_MESSAGE( PREFIX("&c[&6&lPlot&c] "), ENABLED("&6Plots are now enabled"), EXAMPLE_MESSAGE(
"&cThis is an example message &k!!!"), "&cThis is an example message &k!!!"),
/* /*
* Reload * Reload
*/ */
RELOADED_CONFIGS("&6The translation files has been reloaded"), RELOAD_FAILED( RELOADED_CONFIGS("&6The translation files has been reloaded"), RELOAD_FAILED(
"&cFailed to reload the translations file"), "&cFailed to reload the translations file"),
/* /*
* BarAPI * BarAPI
*/ */
BOSSBAR_CLEARING("&cClearing plot: &6%id%"), BOSSBAR_CLEARING("&cClearing plot: &6%id%"),
/* /*
* Alias * Alias
*/ */
ALIAS_SET_TO("&cPlot alias set to &6%alias%"), MISSING_ALIAS( ALIAS_SET_TO("&cPlot alias set to &6%alias%"), MISSING_ALIAS(
"&cYou need to specify the alias"), ALIAS_IS_TAKEN( "&cYou need to specify the alias"), ALIAS_IS_TAKEN(
"&cThat alias is already taken"), "&cThat alias is already taken"),
/* /*
* Position * Position
*/ */
MISSING_POSITION( MISSING_POSITION(
"&cYou need to specify a position. Possible values: &6default&c, &6center"), POSITION_SET( "&cYou need to specify a position. Possible values: &6default&c, &6center"), POSITION_SET(
"&cPlot home position set"), INVALID_POSITION( "&cPlot home position set"), INVALID_POSITION(
"&cThat is not a valid position value"), "&cThat is not a valid position value"),
/* /*
* Time * Time
*/ */
TIME_FORMAT("&6%hours%, %min%, %sec%"), TIME_FORMAT("&6%hours%, %min%, %sec%"),
/* /*
* Permission * Permission
*/ */
NO_SCHEMATIC_PERMISSION( NO_SCHEMATIC_PERMISSION(
"&cYou don't have the permission required to use schematic &6%s"), NO_PERMISSION( "&cYou don't have the permission required to use schematic &6%s"), NO_PERMISSION(
"&cYou don't have the permissions required to use this command."), NO_PLOT_PERMS( "&cYou don't have the permissions required to use this command."), NO_PLOT_PERMS(
"&cYou don't have the permissions to do that in this plot"), CANT_CLAIM_MORE_PLOTS( "&cYou don't have the permissions to do that in this plot"), CANT_CLAIM_MORE_PLOTS(
"&cYou can't claim more plots."), YOU_BE_DENIED( "&cYou can't claim more plots."), YOU_BE_DENIED(
"&cYou are not allowed to enter this plot"), "&cYou are not allowed to enter this plot"),
NO_PERM_MERGE("&cYou are not the owner of the plot: &6%plot%"), UNLINK_REQUIRED( NO_PERM_MERGE("&cYou are not the owner of the plot: &6%plot%"), UNLINK_REQUIRED(
"&cAn unlink is required to do this."), UNLINK_IMPOSSIBLE( "&cAn unlink is required to do this."), UNLINK_IMPOSSIBLE(
"&cYou can only unlink a mega-plot"), NO_MERGE_TO_MEGA( "&cYou can only unlink a mega-plot"), NO_MERGE_TO_MEGA(
"&cMega plots cannot be merged into. Please merge from the desired mega plot."), "&cMega plots cannot be merged into. Please merge from the desired mega plot."),
/* /*
* Commands * Commands
*/ */
NOT_VALID_SUBCOMMAND("&cThat is not a valid subcommand."), NO_COMMANDS( NOT_VALID_SUBCOMMAND("&cThat is not a valid subcommand."), NO_COMMANDS(
"&cI'm sorry, but you're not permitted to use any subcommands."), SUBCOMMAND_SET_OPTIONS_HEADER( "&cI'm sorry, but you're not permitted to use any subcommands."), SUBCOMMAND_SET_OPTIONS_HEADER(
"&cPossible Values: "), "&cPossible Values: "),
/* /*
* Player not found * Player not found
*/ */
INVALID_PLAYER("&cPlayer not found: &6%player%."), INVALID_PLAYER("&cPlayer not found: &6%player%."),
/* /*
* *
*/ */
COMMAND_WENT_WRONG("&cSomething went wrong when executing that command..."), COMMAND_WENT_WRONG("&cSomething went wrong when executing that command..."),
/* /*
* No {plot} * No {plot}
*/ */
NOT_IN_PLOT("&cYou're not in a plot"), NOT_IN_PLOT_WORLD( NOT_IN_PLOT("&cYou're not in a plot"), NOT_IN_PLOT_WORLD(
"&cYou're not in a plot world"), NOT_VALID_WORLD( "&cYou're not in a plot world"), NOT_VALID_WORLD(
"&cThat is not a valid world (case sensitive)"), NOT_VALID_PLOT_WORLD( "&cThat is not a valid world (case sensitive)"), NOT_VALID_PLOT_WORLD(
"&cThat is not a valid plot world (case sensitive)"), NO_PLOTS( "&cThat is not a valid plot world (case sensitive)"), NO_PLOTS(
"&cYou don't have any plots"), "&cYou don't have any plots"),
/* /*
* Block List * Block List
*/ */
NOT_VALID_BLOCK_LIST_HEADER( NOT_VALID_BLOCK_LIST_HEADER(
"&cThat's not a valid block. Valid blocks are:\\n"), BLOCK_LIST_ITEM( "&cThat's not a valid block. Valid blocks are:\\n"), BLOCK_LIST_ITEM(
" &6%mat%&c,"), BLOCK_LIST_SEPARATER("&6,&c "), " &6%mat%&c,"), BLOCK_LIST_SEPARATER("&6,&c "),
/* /*
* Biome * Biome
*/ */
NEED_BIOME("&cYou've got to specify a biome"), BIOME_SET_TO( NEED_BIOME("&cYou've got to specify a biome"), BIOME_SET_TO(
"&cPlot biome set to &c"), "&cPlot biome set to &c"),
/* /*
* Teleport / Entry * Teleport / Entry
*/ */
TELEPORTED_TO_PLOT("&6You have been teleported"), TELEPORTED_TO_PLOT("&6You have been teleported"),
/* /*
* Set Block * Set Block
*/ */
SET_BLOCK_ACTION_FINISHED("&6The last setblock action is now finished."), SET_BLOCK_ACTION_FINISHED("&6The last setblock action is now finished."),
/* /*
* Debug * Debug
*/ */
DEUBG_HEADER("&6Debug Information\\n"), DEBUG_SECTION("&c>> &6&l%val%"), DEBUG_LINE( DEUBG_HEADER("&6Debug Information\\n"), DEBUG_SECTION("&c>> &6&l%val%"), DEBUG_LINE(
"&c>> &6%var%&c:&6 %val%\\n"), "&c>> &6%var%&c:&6 %val%\\n"),
/* /*
* Invalid * Invalid
*/ */
NOT_VALID_DATA("&cThat's not a valid data id."), NOT_VALID_BLOCK( NOT_VALID_DATA("&cThat's not a valid data id."), NOT_VALID_BLOCK(
"&cThat's not a valid block."), NOT_VALID_NUMBER( "&cThat's not a valid block."), NOT_VALID_NUMBER(
"&cThat's not a valid number"), NOT_VALID_PLOT_ID( "&cThat's not a valid number"), NOT_VALID_PLOT_ID(
"&cThat's not a valid plot id."), NOT_YOUR_PLOT( "&cThat's not a valid plot id."), NOT_YOUR_PLOT(
"&cThat is not your plot."), NO_SUCH_PLOT("&cThere is no such plot"), PLAYER_HAS_NOT_BEEN_ON( "&cThat is not your plot."), NO_SUCH_PLOT("&cThere is no such plot"), PLAYER_HAS_NOT_BEEN_ON(
"&cThat player hasn't been in the plotworld"), FOUND_NO_PLOTS( "&cThat player hasn't been in the plotworld"), FOUND_NO_PLOTS(
"&cFound no plots with your search query"), "&cFound no plots with your search query"),
/* /*
* Camera * Camera
*/ */
CAMERA_STARTED("&cYou have entered camera mode for plot &6%s"), CAMERA_STOPPED( CAMERA_STARTED("&cYou have entered camera mode for plot &6%s"), CAMERA_STOPPED(
"&cYou are no longer in camera mode"), "&cYou are no longer in camera mode"),
/* /*
* Need * Need
*/ */
NEED_PLOT_NUMBER("&cYou've got to specify a plot number or alias"), NEED_BLOCK( NEED_PLOT_NUMBER("&cYou've got to specify a plot number or alias"), NEED_BLOCK(
"&cYou've got to specify a block"), NEED_PLOT_ID( "&cYou've got to specify a block"), NEED_PLOT_ID(
"&cYou've got to specify a plot id."), NEED_USER( "&cYou've got to specify a plot id."), NEED_USER(
"&cYou need to specify a username"), "&cYou need to specify a username"),
/* /*
* Info * Info
*/ */
PLOT_INFO_UNCLAIMED("&cPlot &6%s&c is not yet claimed"), PLOT_INFO( PLOT_INFO_UNCLAIMED("&cPlot &6%s&c is not yet claimed"), PLOT_INFO(
"plot ID: &6%id%&c, plot Alias: &6%alias%&c, plot Owner: &6%owner%&c, plot Biome: &6%biome%&c, plot Time: &6%time%&c, plot Weather: &6%weather%&c, plot Helpers:&6%helpers%&c, plot Trusted:&6%trusted%&c, plot Denied:&6%denied%&c, plot Rating: &6%rating%, &cplot flags: &6%flags%"), PLOT_USER_LIST( "plot ID: &6%id%&c, plot Alias: &6%alias%&c, plot Owner: &6%owner%&c, plot Biome: &6%biome%&c, plot Time: &6%time%&c, plot Weather: &6%weather%&c, plot Helpers:&6%helpers%&c, plot Trusted:&6%trusted%&c, plot Denied:&6%denied%&c, plot Rating: &6%rating%, &cplot flags: &6%flags%"), PLOT_USER_LIST(
" &6%user%&c,"), " &6%user%&c,"),
/* /*
* Generating * Generating
*/ */
GENERATING_FLOOR( GENERATING_FLOOR(
"&6Started generating floor from your settings. It will take %time%"), GENERATING_WALL( "&6Started generating floor from your settings. It will take %time%"), GENERATING_WALL(
"&6Started generating wall from your settings"), GENERATING_WALL_FILLING( "&6Started generating wall from your settings"), GENERATING_WALL_FILLING(
"&cStarted generating wall filling from your settings."), "&cStarted generating wall filling from your settings."),
/* /*
* Clearing * Clearing
*/ */
CLEARING_PLOT("&cClearing plot."), CLEARING_DONE( CLEARING_PLOT("&cClearing plot."), CLEARING_DONE(
"&6Done, took &a%time%&6 ms!"), CLEARING_DONE_PACKETS( "&6Done, took &a%time%&6 ms!"), CLEARING_DONE_PACKETS(
"&6(&a%time% &6ms for packets)"), "&6(&a%time% &6ms for packets)"),
/* /*
* Claiming * Claiming
*/ */
PLOT_NOT_CLAIMED("&cCannot claim plot"), PLOT_IS_CLAIMED( PLOT_NOT_CLAIMED("&cCannot claim plot"), PLOT_IS_CLAIMED(
"&cThis plot is already claimed"), CLAIMED( "&cThis plot is already claimed"), CLAIMED(
"&6You successfully claimed the plot"), "&6You successfully claimed the plot"),
/* /*
* List * List
*/ */
PLOT_LIST_HEADER("&6List of %word% plots"), PLOT_LIST_ITEM( PLOT_LIST_HEADER("&6List of %word% plots"), PLOT_LIST_ITEM(
"&c>> &6%id% &c- &6%owner%"), PLOT_LIST_FOOTER( "&c>> &6%id% &c- &6%owner%"), PLOT_LIST_FOOTER(
"&c>> &6%word% a total of &c%num% &6claimed %plot%."), "&c>> &6%word% a total of &c%num% &6claimed %plot%."),
/* /*
* Left * Left
*/ */
LEFT_PLOT("&cYou left a plot"), LEFT_PLOT("&cYou left a plot"),
/* /*
* Wait * Wait
*/ */
WAIT_FOR_TIMER( WAIT_FOR_TIMER(
"&cA setblock timer is bound to either the current plot or you. Please wait for it to finish"), "&cA setblock timer is bound to either the current plot or you. Please wait for it to finish"),
/* /*
* Chat * Chat
*/ */
PLOT_CHAT_FORMAT("&c[&6Plot Chat&c][&6%plot_id%&c] &6%sender%&c: &6%msg%"), PLOT_CHAT_FORMAT("&c[&6Plot Chat&c][&6%plot_id%&c] &6%sender%&c: &6%msg%"),
/* /*
* Denied * Denied
*/ */
DENIED_REMOVED("&cYou successfully undenied the player from this plot"), DENIED_ADDED( DENIED_REMOVED("&cYou successfully undenied the player from this plot"), DENIED_ADDED(
"&cYou successfully denied the player from this plot"), DENIED_NEED_ARGUMENT( "&cYou successfully denied the player from this plot"), DENIED_NEED_ARGUMENT(
"&cArguments are missing. &6/plot denied add {name} &cor &6/plot helpers remove {name}"), WAS_NOT_DENIED( "&cArguments are missing. &6/plot denied add {name} &cor &6/plot helpers remove {name}"), WAS_NOT_DENIED(
"&cThat player was not denied on this plot"), "&cThat player was not denied on this plot"),
/* /*
* Rain * Rain
*/ */
NEED_ON_OFF("&cYou need to specify a value. Possible values: &6on&c, &6off"), SETTING_UPDATED( NEED_ON_OFF("&cYou need to specify a value. Possible values: &6on&c, &6off"), SETTING_UPDATED(
"&cYou successfully updated the setting"), "&cYou successfully updated the setting"),
/* /*
* Flag * Flag
*/ */
NEED_KEY("&cPossible values: &6%values%"), NOT_VALID_FLAG( NEED_KEY("&cPossible values: &6%values%"), NOT_VALID_FLAG(
"&cThat is not a valid flag"), NOT_VALID_VALUE( "&cThat is not a valid flag"), NOT_VALID_VALUE(
"&cFlag values must be alphanumerical"), FLAG_NOT_IN_PLOT( "&cFlag values must be alphanumerical"), FLAG_NOT_IN_PLOT(
"&cThe plot does not have that flag"), FLAG_NOT_REMOVED( "&cThe plot does not have that flag"), FLAG_NOT_REMOVED(
@ -239,45 +241,45 @@ public enum C {
"&cThe flag could not be added"), FLAG_REMOVED( "&cThe flag could not be added"), FLAG_REMOVED(
"&6Successfully removed flag"), FLAG_ADDED( "&6Successfully removed flag"), FLAG_ADDED(
"&6Successfully added flag"), "&6Successfully added flag"),
/* /*
* Helper * Helper
*/ */
HELPER_ADDED("&6You successfully added a helper to the plot"), HELPER_REMOVED( HELPER_ADDED("&6You successfully added a helper to the plot"), HELPER_REMOVED(
"&6You successfully removed a helper from the plot"), HELPER_NEED_ARGUMENT( "&6You successfully removed a helper from the plot"), HELPER_NEED_ARGUMENT(
"&cArguments are missing. &6/plot helpers add {name} &cor &6/plot helpers remove {name}"), WAS_NOT_ADDED( "&cArguments are missing. &6/plot helpers add {name} &cor &6/plot helpers remove {name}"), WAS_NOT_ADDED(
"&cThat player was not added as a helper on this plot"), "&cThat player was not added as a helper on this plot"),
/* /*
* Trusted * Trusted
*/ */
TRUSTED_ADDED("&6You successfully added a trusted user to the plot"), TRUSTED_REMOVED( TRUSTED_ADDED("&6You successfully added a trusted user to the plot"), TRUSTED_REMOVED(
"&6You successfully removed a trusted user from the plot"), TRUSTED_NEED_ARGUMENT( "&6You successfully removed a trusted user from the plot"), TRUSTED_NEED_ARGUMENT(
"&cArguments are missing. &6/plot trusted add {name} &cor &6/plot trusted remove {name}"), T_WAS_NOT_ADDED( "&cArguments are missing. &6/plot trusted add {name} &cor &6/plot trusted remove {name}"), T_WAS_NOT_ADDED(
"&cThat player was not added as a trusted user on this plot"), "&cThat player was not added as a trusted user on this plot"),
/* /*
* Set Owner * Set Owner
*/ */
SET_OWNER("&6You successfully set the plot owner"), SET_OWNER("&6You successfully set the plot owner"),
/* /*
* Signs * Signs
*/ */
OWNER_SIGN_LINE_1("&cID: &6%id%"), OWNER_SIGN_LINE_2("&cOwner:"), OWNER_SIGN_LINE_3( OWNER_SIGN_LINE_1("&cID: &6%id%"), OWNER_SIGN_LINE_2("&cOwner:"), OWNER_SIGN_LINE_3(
"&6%plr%"), OWNER_SIGN_LINE_4("&2Claimed"), "&6%plr%"), OWNER_SIGN_LINE_4("&2Claimed"),
/* /*
* Help * Help
*/ */
HELP_CATEGORY("&6Current Category&c: &l%category%"), HELP_INFO( HELP_CATEGORY("&6Current Category&c: &l%category%"), HELP_INFO(
"&6You need to specify a help category"), HELP_INFO_ITEM( "&6You need to specify a help category"), HELP_INFO_ITEM(
"&6/plots help %category% &c- &6%category_desc%"), HELP_PAGE( "&6/plots help %category% &c- &6%category_desc%"), HELP_PAGE(
"&c>> &6%usage% &c[&6%alias%&c] &c- &6%desc%"), HELP_HEADER( "&c>> &6%usage% &c[&6%alias%&c] &c- &6%desc%"), HELP_HEADER(
"&6Help for Plots"), "&6Help for Plots"),
/* /*
* Direction * Direction
*/ */
DIRECTION("&6Current direction: %dir%"), DIRECTION("&6Current direction: %dir%"),
/* /*
* Custom * Custom
*/ */
CUSTOM_STRING("-"); CUSTOM_STRING("-");
/** /**
* Default * Default
*/ */

View File

@ -9,6 +9,7 @@
package com.intellectualcrafters.plot.api; package com.intellectualcrafters.plot.api;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Set; import java.util.Set;
@ -26,7 +27,9 @@ import com.intellectualcrafters.plot.Plot;
import com.intellectualcrafters.plot.PlotHelper; import com.intellectualcrafters.plot.PlotHelper;
import com.intellectualcrafters.plot.PlotId; import com.intellectualcrafters.plot.PlotId;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.PlotManager;
import com.intellectualcrafters.plot.PlotWorld; import com.intellectualcrafters.plot.PlotWorld;
import com.intellectualcrafters.plot.SchematicHandler;
import com.intellectualcrafters.plot.commands.MainCommand; import com.intellectualcrafters.plot.commands.MainCommand;
import com.intellectualcrafters.plot.commands.SubCommand; import com.intellectualcrafters.plot.commands.SubCommand;
@ -38,6 +41,34 @@ import com.intellectualcrafters.plot.commands.SubCommand;
@SuppressWarnings({ "unused", "javadoc" }) @SuppressWarnings({ "unused", "javadoc" })
public class PlotAPI { public class PlotAPI {
private static PlotHelper plotHelper;
private static PlayerFunctions playerFunctions;
private static FlagManager flagManager;
private static SchematicHandler schematicHandler;
private static C c;
// Methods/fields in PlotMain class
// PlotMain.config;
// PlotMain.storage
// PlotMain.translations
// PlotMain.addPlotWorld(world, plotworld, manager);
//
// PlotMain.checkForExpiredPlots();
// PlotMain.killAllEntities();
//
// PlotMain.createConfiguration(plotworld);
// PlotMain.getPlots()
// PlotMain.getPlots(player)
// PlotMain.getPlots(world)
// PlotMain.getPlots(world, player)
// PlotMain.getWorldPlots(world)
// PlotMain.getPlotWorlds()
// PlotMain.isPlotWorld(world)
// PlotMain.removePlot(world, id, callEvent)
// PlotMain.teleportPlayer(player, from, plot)
// PlotMain.updatePlot(plot);
// To access plotMain stuff. // To access plotMain stuff.
private PlotMain plotMain; private PlotMain plotMain;
// Reference // Reference
@ -52,6 +83,111 @@ public class PlotAPI {
this.plotMain = JavaPlugin.getPlugin(PlotMain.class); this.plotMain = JavaPlugin.getPlugin(PlotMain.class);
} }
/**
* Get the main class for this plugin <br>
* - Contains a lot of fields and methods
* - not very well organized
*
* @return
*/
public PlotMain getMain() {
return plotMain;
}
/**
* PlotHelper class contains useful methods relating to plots.
*
* @return
*/
public PlotHelper getPlotHelper() {
return plotHelper;
}
/**
* PlayerFunctions class contains useful methods relating to players
* - Some player/plot methods are here as well
*
* @return
*/
public PlayerFunctions getPlayerFunctions() {
return playerFunctions;
}
/**
* FlagManager class contains methods relating to plot flags
*
* @return
*/
public FlagManager getFlagManager() {
return flagManager;
}
/**
* SchematicHandler class contains methods related to pasting schematics
*
* @return
*/
public SchematicHandler getSchematicHandler() {
return schematicHandler;
}
/**
* C class contains all the captions from the translations.yml file.
*
* @return
*/
public C getCaptions() {
return c;
}
/**
* Get the plot manager for a world.
* - Most of these methods can be accessed through the PlotHelper
*
* @param world
* @return
*/
public PlotManager getPlotManager(World world) {
return PlotMain.getPlotManager(world);
}
/**
* Get the plot manager for a world.
* - Contains useful low level methods for plot merging, clearing, and tessellation
*
* @param world
* @return
*/
public PlotManager getPlotManager(String world) {
return PlotMain.getPlotManager(world);
}
/**
* Get the settings for a world (settings bundled in PlotWorld class)
* - You will need to downcast for the specific settings a Generator has.
* e.g. DefaultPlotWorld class implements PlotWorld
*
* @param world
* (to get settings of)
* @return PlotWorld class for that world ! will return null if not a plot world
* world
*/
public PlotWorld getWorldSettings(World world) {
return PlotMain.getWorldSettings(world);
}
/**
* Get the settings for a world (settings bundled in PlotWorld class)
*
* @param world
* (to get settings of)
* @return PlotWorld class for that world ! will return null if not a plot world
* world
*/
public PlotWorld getWorldSettings(String world) {
return PlotMain.getWorldSettings(world);
}
/** /**
* Send a message to a player. * Send a message to a player.
* *
@ -65,6 +201,7 @@ public class PlotAPI {
/** /**
* Send a message to a player. * Send a message to a player.
* - Supports color codes
* *
* @param player * @param player
* @param string * @param string
@ -75,6 +212,7 @@ public class PlotAPI {
/** /**
* Send a message to the console. * Send a message to the console.
* - Supports color codes
* *
* @param msg * @param msg
*/ */
@ -208,18 +346,6 @@ public class PlotAPI {
return PlotMain.isPlotWorld(world); return PlotMain.isPlotWorld(world);
} }
/**
* Get the settings for a world (settings bundled in PlotWorld class)
*
* @param world
* (to get settings of)
* @return PlotWorld class for ther world ! will return null if not a plot
* world
*/
public PlotWorld getWorldSettings(World world) {
return PlotMain.getWorldSettings(world);
}
/** /**
* Get plot locations * Get plot locations
* *

View File

@ -1,18 +1,24 @@
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.Plugin;
import com.intellectualcrafters.plot.C; import com.intellectualcrafters.plot.C;
import com.intellectualcrafters.plot.ConfigurationNode; import com.intellectualcrafters.plot.ConfigurationNode;
import com.intellectualcrafters.plot.PlayerFunctions; import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.PlotGenerator;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.PlotWorld; import com.intellectualcrafters.plot.PlotWorld;
import com.intellectualcrafters.plot.generator.DefaultPlotWorld;
/** /**
* Created by Citymonstret on 2014-09-26. * Created by Citymonstret on 2014-09-26.
@ -23,13 +29,19 @@ public class Setup extends SubCommand implements Listener {
private class SetupObject { private class SetupObject {
String world; String world;
String plugin;
int current = 0; int current = 0;
ConfigurationNode[] step; ConfigurationNode[] step;
public SetupObject(String world, PlotWorld plotworld) { public SetupObject(String world, PlotWorld plotworld, String plugin) {
this.world = world; this.world = world;
this.step = plotworld.getSettingNodes(); this.step = plotworld.getSettingNodes();
this.plugin = plugin;
}
public String getPlugin() {
return this.plugin;
} }
public int getCurrent() { public int getCurrent() {
@ -50,19 +62,9 @@ public class Setup extends SubCommand implements Listener {
public boolean execute(Player plr, String... args) { public boolean execute(Player plr, String... args) {
boolean finished = false; boolean finished = false;
if (!finished) {
// TODO recode this to work with the multiple generators
PlayerFunctions
.sendMessage(plr, "&4CURRENTLY NOT IMPLEMENTED YET!");
return false;
}
if (setupMap.containsKey(plr.getName())) { if (setupMap.containsKey(plr.getName())) {
SetupObject object = setupMap.get(plr.getName()); SetupObject object = setupMap.get(plr.getName());
if (object.getCurrent() == object.getMax()) { if (object.getCurrent() == object.getMax()) {
sendMessage(plr, C.SETUP_FINISHED, object.world);
ConfigurationNode[] steps = object.step; ConfigurationNode[] steps = object.step;
String world = object.world; String world = object.world;
for (ConfigurationNode step : steps) { for (ConfigurationNode step : steps) {
@ -76,9 +78,14 @@ public class Setup extends SubCommand implements Listener {
e.printStackTrace(); e.printStackTrace();
} }
// World newWorld = WorldCreator.name(world).generator(new // Creating the worlds
// WorldGenerator(world)).createWorld(); if (object.getPlugin().equals("Multiverse-Core")) {
// plr.teleport(newWorld.getSpawnLocation()); Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv create "+world+" normal -g "+object.plugin);
}
else if (object.getPlugin().equals("MultiWorld")) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw create "+world+" plugin:"+object.plugin);
}
sendMessage(plr, C.SETUP_FINISHED, object.world);
setupMap.remove(plr.getName()); setupMap.remove(plr.getName());
@ -140,19 +147,52 @@ public class Setup extends SubCommand implements Listener {
sendMessage(plr, C.SETUP_MISSING_WORLD); sendMessage(plr, C.SETUP_MISSING_WORLD);
return true; return true;
} }
if (args.length < 2) {
sendMessage(plr, C.SETUP_MISSING_GENERATOR);
return true;
}
String world = args[0]; String world = args[0];
if (StringUtils.isNumeric(args[0])) { if (StringUtils.isNumeric(args[0])) {
sendMessage(plr, C.SETUP_WORLD_TAKEN, world); sendMessage(plr, C.SETUP_WORLD_TAKEN, world);
return true; return true;
} }
if (PlotMain.getWorldSettings(world) != null) { if (PlotMain.getWorldSettings(world) != null) {
sendMessage(plr, C.SETUP_WORLD_TAKEN, world); sendMessage(plr, C.SETUP_WORLD_TAKEN, world);
return true; return true;
} }
PlotWorld plotworld = PlotMain.getWorldSettings("//TODO"); // TODO ArrayList<String> generators = new ArrayList<String>();
setupMap.put(plr.getName(), new SetupObject(world, plotworld)); ChunkGenerator generator = null;
for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
if (plugin.isEnabled()) {
ChunkGenerator currentGen = plugin.getDefaultWorldGenerator("world", "");
if (currentGen != null) {
String name = plugin.getDescription().getName();
generators.add(name);
if (args[1].equals(name)) {
generator = currentGen;
break;
}
}
}
}
if (generator == null) {
sendMessage(plr, C.SETUP_INVALID_GENERATOR, StringUtils.join(generators,C.BLOCK_LIST_SEPARATER.s()));
return true;
}
PlotWorld plotworld;
if (generator instanceof PlotGenerator) {
plotworld = ((PlotGenerator) generator).getPlotWorld();
}
else {
plotworld = new DefaultPlotWorld(world);
}
setupMap.put(plr.getName(), new SetupObject(world, plotworld, args[1]));
sendMessage(plr, C.SETUP_INIT); sendMessage(plr, C.SETUP_INIT);
SetupObject object = setupMap.get(plr.getName()); SetupObject object = setupMap.get(plr.getName());
ConfigurationNode step = object.step[object.current]; ConfigurationNode step = object.step[object.current];

View File

@ -25,6 +25,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -523,16 +524,19 @@ public class PlayerEvents implements Listener {
} }
if (isInPlot(event.getClickedBlock().getLocation())) { if (isInPlot(event.getClickedBlock().getLocation())) {
Plot plot = getCurrentPlot(event.getClickedBlock().getLocation()); Plot plot = getCurrentPlot(event.getClickedBlock().getLocation());
if (new ArrayList<>(Arrays.asList(new Material[] {
Material.STONE_BUTTON, Material.WOOD_BUTTON,
Material.LEVER, Material.STONE_PLATE, Material.WOOD_PLATE,
Material.CHEST, Material.TRAPPED_CHEST, Material.TRAP_DOOR,
Material.WOOD_DOOR, Material.WOODEN_DOOR,
Material.DISPENSER, Material.DROPPER
})).contains(event.getClickedBlock().getType())) { // They shouldn't be allowed to access other people's chests
return;
} // if (new ArrayList<>(Arrays.asList(new Material[] {
// Material.STONE_BUTTON, Material.WOOD_BUTTON,
// Material.LEVER, Material.STONE_PLATE, Material.WOOD_PLATE,
// Material.CHEST, Material.TRAPPED_CHEST, Material.TRAP_DOOR,
// Material.WOOD_DOOR, Material.WOODEN_DOOR,
// Material.DISPENSER, Material.DROPPER
//
// })).contains(event.getClickedBlock().getType())) {
// return;
// }
if (!plot.hasRights(event.getPlayer())) { if (!plot.hasRights(event.getPlayer())) {
event.setCancelled(true); event.setCancelled(true);
} }
@ -548,7 +552,7 @@ public class PlayerEvents implements Listener {
if (!isPlotWorld(world)) { if (!isPlotWorld(world)) {
return; return;
} }
if (event.getEntity() instanceof Player) { if (event.getEntity().getType() == EntityType.PLAYER) {
return; return;
} }
if (!isInPlot(event.getLocation())) { if (!isInPlot(event.getLocation())) {