Merge branch 'develop' of https://github.com/tastybento/bskyblock.git into develop

This commit is contained in:
Tastybento 2018-01-27 15:48:53 -08:00
commit 970711ca63
11 changed files with 52 additions and 32 deletions

View File

@ -213,7 +213,7 @@ protection:
new-island: new-island:
sign: sign:
line1: "&1%bsb_plugin_name%" line0: "&1%bsb_plugin_name%"
line2: "[player]" line1: "[player]"
line3: "Don't fall!" line2: "Don't fall!"
line4: "Have fun! &c<3" line3: "Have fun! &c<3"

View File

@ -1,7 +1,7 @@
package us.tastybento.bskyblock; package us.tastybento.bskyblock;
/** /**
* All the plugin settings are here * All the plugin constants are here
* @author Tastybento * @author Tastybento
*/ */
public class Constants { public class Constants {
@ -18,8 +18,6 @@ public class Constants {
public final static String PERMPREFIX = "acidisland."; public final static String PERMPREFIX = "acidisland.";
// The island command // The island command
public final static String ISLANDCOMMAND = "ai"; public final static String ISLANDCOMMAND = "ai";
// The challenge command
public static final String CHALLENGECOMMAND = "aic";
// Admin command // Admin command
public static final String ADMINCOMMAND = "acid"; public static final String ADMINCOMMAND = "acid";
*/ */
@ -28,8 +26,6 @@ public class Constants {
public final static String PERMPREFIX = "bskyblock."; public final static String PERMPREFIX = "bskyblock.";
// The island command // The island command
public final static String ISLANDCOMMAND = "island"; public final static String ISLANDCOMMAND = "island";
// The challenge command
public static final String CHALLENGECOMMAND = "bsc";
// The spawn command (Essentials spawn for example) // The spawn command (Essentials spawn for example)
public final static String SPAWNCOMMAND = "spawn"; public final static String SPAWNCOMMAND = "spawn";
// Admin command // Admin command

View File

@ -2,9 +2,12 @@ package us.tastybento.bskyblock.api.flags;
import java.util.Optional; import java.util.Optional;
import org.bukkit.Material;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import us.tastybento.bskyblock.api.panels.PanelItem; import us.tastybento.bskyblock.api.panels.PanelItem;
import us.tastybento.bskyblock.api.panels.builders.PanelItemBuilder;
public class FlagBuilder { public class FlagBuilder {
@ -17,8 +20,16 @@ public class FlagBuilder {
return this; return this;
} }
public FlagBuilder icon(Material icon) {
icon(new PanelItemBuilder().icon(new ItemStack(icon)).build());
return this;
}
public FlagBuilder icon(PanelItem icon) { public FlagBuilder icon(PanelItem icon) {
this.icon = icon; this.icon = icon;
//TODO: if icon don't have a clickhandler, add the default one
//TODO: if icon don't have a display name, set it to the default reference
//TODO: if icon don't have a lore, set it to the default one
return this; return this;
} }
@ -27,7 +38,7 @@ public class FlagBuilder {
return this; return this;
} }
public void build() { public Flag build() {
new Flag(id, icon, listener); return new Flag(id, icon, listener);
} }
} }

View File

@ -15,27 +15,27 @@ public class PanelItemBuilder {
private boolean glow; private boolean glow;
private Optional<PanelItem.ClickHandler> clickHandler = Optional.empty(); private Optional<PanelItem.ClickHandler> clickHandler = Optional.empty();
public PanelItemBuilder setIcon(ItemStack icon) { public PanelItemBuilder icon(ItemStack icon) {
this.icon = icon; this.icon = icon;
return this; return this;
} }
public PanelItemBuilder setName(String name) { public PanelItemBuilder name(String name) {
this.name = name; this.name = name;
return this; return this;
} }
public PanelItemBuilder setDescription(List<String> list) { public PanelItemBuilder description(List<String> list) {
this.description = list; this.description = list;
return this; return this;
} }
public PanelItemBuilder setGlow(boolean glow) { public PanelItemBuilder glow(boolean glow) {
this.glow = glow; this.glow = glow;
return this; return this;
} }
public PanelItemBuilder setClickHandler(ClickHandler clickHandler) { public PanelItemBuilder clickHandler(ClickHandler clickHandler) {
this.clickHandler = Optional.of(clickHandler); this.clickHandler = Optional.of(clickHandler);
return this; return this;
} }

View File

@ -35,7 +35,7 @@ public class IslandBuilder {
ISLAND, ISLAND,
NETHER, NETHER,
END END
}; }
private Island island; private Island island;
private World world; private World world;
@ -48,7 +48,6 @@ public class IslandBuilder {
private BSkyBlock plugin; private BSkyBlock plugin;
public IslandBuilder(BSkyBlock plugin, Island island) { public IslandBuilder(BSkyBlock plugin, Island island) {
super();
this.plugin = plugin; this.plugin = plugin;
this.island = island; this.island = island;
this.world = island.getWorld(); this.world = island.getWorld();
@ -482,7 +481,7 @@ public class IslandBuilder {
Sign sign = (Sign) blockToChange.getState(); Sign sign = (Sign) blockToChange.getState();
User user = User.getInstance(playerUUID); User user = User.getInstance(playerUUID);
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
sign.setLine(i, user.getTranslation("new-island.sign.line" + (i+1), "[player]", playerName)); sign.setLine(i, user.getTranslation("new-island.sign.line" + i, "[player]", playerName));
} }
((org.bukkit.material.Sign) sign.getData()).setFacingDirection(BlockFace.NORTH); ((org.bukkit.material.Sign) sign.getData()).setFacingDirection(BlockFace.NORTH);
sign.update(); sign.update();

View File

@ -0,0 +1,6 @@
package us.tastybento.bskyblock.listeners.flags;
import org.bukkit.event.Listener;
public class BreakBlocksListener implements Listener {
}

View File

@ -0,0 +1,6 @@
package us.tastybento.bskyblock.listeners.flags;
import org.bukkit.event.Listener;
public class PlaceBlocksListener implements Listener {
}

View File

@ -0,0 +1,12 @@
package us.tastybento.bskyblock.lists;
import org.bukkit.Material;
import us.tastybento.bskyblock.api.flags.Flag;
import us.tastybento.bskyblock.api.flags.FlagBuilder;
import us.tastybento.bskyblock.listeners.flags.*;
public class Flags {
public static final Flag BREAK_BLOCKS = new FlagBuilder().id("BREAK_BLOCKS").icon(Material.STONE).listener(new BreakBlocksListener()).build();
public static final Flag PLACE_BLOCKS = new FlagBuilder().id("PLACE_BLOCKS").icon(Material.DIRT).listener(new PlaceBlocksListener()).build();
}

View File

@ -37,8 +37,6 @@ public final class AddonsManager {
private final Map<String, Class<?>> classes = new HashMap<String, Class<?>>(); private final Map<String, Class<?>> classes = new HashMap<String, Class<?>>();
private BSkyBlock plugin; private BSkyBlock plugin;
public AddonsManager(BSkyBlock plugin) { public AddonsManager(BSkyBlock plugin) {
this.plugin = plugin; this.plugin = plugin;
this.addons = new ArrayList<>(); this.addons = new ArrayList<>();
@ -47,7 +45,6 @@ public final class AddonsManager {
/** /**
* Loads all the addons from the addons folder * Loads all the addons from the addons folder
* @throws InvalidDescriptionException
*/ */
public void enableAddons() { public void enableAddons() {
File f = new File(plugin.getDataFolder(), "addons"); File f = new File(plugin.getDataFolder(), "addons");
@ -57,11 +54,7 @@ public final class AddonsManager {
if (!file.isDirectory()) { if (!file.isDirectory()) {
try { try {
this.loadAddon(file); this.loadAddon(file);
} catch (InvalidAddonFormatException e) { } catch (InvalidAddonFormatException | InvalidAddonInheritException | InvalidDescriptionException e) {
e.printStackTrace();
} catch (InvalidAddonInheritException e) {
e.printStackTrace();
} catch (InvalidDescriptionException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -78,7 +71,7 @@ public final class AddonsManager {
} }
} }
this.addons.stream().forEach(addon -> { this.addons.forEach(addon -> {
addon.onEnable(); addon.onEnable();
Bukkit.getPluginManager().callEvent(AddonEvent.builder().addon(addon).reason(AddonEvent.Reason.ENABLE).build()); Bukkit.getPluginManager().callEvent(AddonEvent.builder().addon(addon).reason(AddonEvent.Reason.ENABLE).build());
addon.setEnabled(true); addon.setEnabled(true);

View File

@ -32,6 +32,4 @@ public final class CommandsManager {
return commands.get(command); return commands.get(command);
} }
} }

View File

@ -11,8 +11,7 @@ import us.tastybento.bskyblock.BSkyBlock;
/** /**
* Handles hooks with other Placeholder APIs. * Handles hooks with other Placeholder APIs.
* *
* @author Poslovitch * @author Poslovitch, Tastybento
* @author Tastybento
*/ */
public class PlaceholderHandler { public class PlaceholderHandler {
private static final String PACKAGE = "us.tastybento.bskyblock.util.placeholders.hooks."; private static final String PACKAGE = "us.tastybento.bskyblock.util.placeholders.hooks.";