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:
sign:
line1: "&1%bsb_plugin_name%"
line2: "[player]"
line3: "Don't fall!"
line4: "Have fun! &c<3"
line0: "&1%bsb_plugin_name%"
line1: "[player]"
line2: "Don't fall!"
line3: "Have fun! &c<3"

View File

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

View File

@ -2,9 +2,12 @@ package us.tastybento.bskyblock.api.flags;
import java.util.Optional;
import org.bukkit.Material;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import us.tastybento.bskyblock.api.panels.PanelItem;
import us.tastybento.bskyblock.api.panels.builders.PanelItemBuilder;
public class FlagBuilder {
@ -17,8 +20,16 @@ public class FlagBuilder {
return this;
}
public FlagBuilder icon(Material icon) {
icon(new PanelItemBuilder().icon(new ItemStack(icon)).build());
return this;
}
public FlagBuilder icon(PanelItem 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;
}
@ -27,7 +38,7 @@ public class FlagBuilder {
return this;
}
public void build() {
new Flag(id, icon, listener);
public Flag build() {
return new Flag(id, icon, listener);
}
}

View File

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

View File

@ -35,7 +35,7 @@ public class IslandBuilder {
ISLAND,
NETHER,
END
};
}
private Island island;
private World world;
@ -48,7 +48,6 @@ public class IslandBuilder {
private BSkyBlock plugin;
public IslandBuilder(BSkyBlock plugin, Island island) {
super();
this.plugin = plugin;
this.island = island;
this.world = island.getWorld();
@ -482,7 +481,7 @@ public class IslandBuilder {
Sign sign = (Sign) blockToChange.getState();
User user = User.getInstance(playerUUID);
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);
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 BSkyBlock plugin;
public AddonsManager(BSkyBlock plugin) {
this.plugin = plugin;
this.addons = new ArrayList<>();
@ -47,7 +45,6 @@ public final class AddonsManager {
/**
* Loads all the addons from the addons folder
* @throws InvalidDescriptionException
*/
public void enableAddons() {
File f = new File(plugin.getDataFolder(), "addons");
@ -57,11 +54,7 @@ public final class AddonsManager {
if (!file.isDirectory()) {
try {
this.loadAddon(file);
} catch (InvalidAddonFormatException e) {
e.printStackTrace();
} catch (InvalidAddonInheritException e) {
e.printStackTrace();
} catch (InvalidDescriptionException e) {
} catch (InvalidAddonFormatException | InvalidAddonInheritException | InvalidDescriptionException e) {
e.printStackTrace();
}
}
@ -78,7 +71,7 @@ public final class AddonsManager {
}
}
this.addons.stream().forEach(addon -> {
this.addons.forEach(addon -> {
addon.onEnable();
Bukkit.getPluginManager().callEvent(AddonEvent.builder().addon(addon).reason(AddonEvent.Reason.ENABLE).build());
addon.setEnabled(true);

View File

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

View File

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