Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/tastybento/askyblock.git
Browse files Browse the repository at this point in the history
…into 3.0.4
  • Loading branch information
tastybento committed Nov 13, 2016
2 parents f1e98e6 + 704b0d9 commit 054bfb2
Show file tree
Hide file tree
Showing 12 changed files with 305 additions and 209 deletions.
19 changes: 19 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,9 @@ general:
# Recommendation is that this is set to true, but if you run multi-worlds
# make sure your economy handles multi-worlds too.
resetmoney: false

# Use the minishop or not
useminishop: true

# Starting money - this is how much money new players will have as their
# balance at the start of an island.
Expand Down Expand Up @@ -580,6 +583,22 @@ general:
# Recommendation is to keep this false.
islandtopteninchat: false

# Toggle Magic Cobblestone Generator
# If set to true, a cobble generator will not just generate cobblestone, but
# also blocks you have specified.
# Default is false, because it highly changes the gameplay.
usemagiccobblegen: false

# This won't be considered if usemagiccobblegen is set to false.
# You can add, remove a block or modify its probability to be generated.
magiccobblegenchances:
COBBLESTONE: 75.0
STONE: 10.0
COAL_ORE: 7.5
IRON_ORE: 5.0
DIAMOND_ORE: 2.0
EMERALD_ORE: 0.5

# Config.yml version. DO NOT EDIT. This number only changes if the latest
# plugin config has been updated. If a new config is detected, it will be
# auto-saved to config.new.yml.
Expand Down
4 changes: 3 additions & 1 deletion src/com/wasteofplastic/askyblock/ASLocale.java
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,8 @@ public class ASLocale {
public String minishopYouSold;
public String minishopBuyProblem;
public String minishopYouCannotAfford;

public String errorMinishopDisabled;

// Sign
public String signLine1;
public String signLine2;
Expand Down Expand Up @@ -754,6 +755,7 @@ public void loadLocale() {
errorUnknownCommand = ChatColor.translateAlternateColorCodes('&', locale.getString("error.unknownCommand", "Unknown command."));
errorNoTeam = ChatColor.translateAlternateColorCodes('&', locale.getString("error.noTeam", "That player is not in a team."));
errorWrongWorld = ChatColor.translateAlternateColorCodes('&', locale.getString("error.wrongWorld", "You cannot do that in this world."));
errorMinishopDisabled = ChatColor.translateAlternateColorCodes('&', locale.getString("error.minishopDisabled", "Minishop is disabled."));
islandProtected = ChatColor.translateAlternateColorCodes('&', locale.getString("islandProtected", "Island protected."));
targetInNoPVPArea = ChatColor.translateAlternateColorCodes('&', locale.getString("targetInPVPArea", "Target is in a no-PVP area!"));
igsTitle = ChatColor.translateAlternateColorCodes('&', locale.getString("islandguardsettings.title", "Island Guard Settings"));
Expand Down
12 changes: 12 additions & 0 deletions src/com/wasteofplastic/askyblock/ASkyBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,8 @@ public boolean loadPluginConfig() {
// Use economy or not
// In future expand to include internal economy
Settings.useEconomy = getConfig().getBoolean("general.useeconomy", true);
// Use the minishop or not
Settings.useMinishop = getConfig().getBoolean("general.useminishop", true);
// Check for updates
Settings.updateCheck = getConfig().getBoolean("general.checkupdates", true);
// Island reset commands
Expand Down Expand Up @@ -1474,6 +1476,16 @@ public boolean loadPluginConfig() {
}
if (Settings.minNameLength > Settings.maxNameLength) {
Settings.minNameLength = Settings.maxNameLength;
}
// Magic Cobble Generator
Settings.useMagicCobbleGen = getConfig().getBoolean("general.usemagiccobblegen", false);
if(Settings.useMagicCobbleGen && getConfig().isSet("general.magiccobblegenchances")){
Settings.magicCobbleGenChances = new HashMap<Material, Double>();
for(String block : getConfig().getConfigurationSection("general.magiccobblegenchances").getKeys(false)){
double chance = getConfig().getDouble("general.magiccobblegenchances." + block, 0D);
if(chance < 0) chance = 0;
if(Material.getMaterial(block) != null && Material.getMaterial(block).isBlock()) Settings.magicCobbleGenChances.put(Material.getMaterial(block), chance);
}
}
// All done
return true;
Expand Down
5 changes: 2 additions & 3 deletions src/com/wasteofplastic/askyblock/CoopPlay.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class CoopPlay {
private ASkyBlock plugin;

/**
* @param instance
* @param plugin
*/
private CoopPlay(ASkyBlock plugin) {
this.plugin = plugin;
Expand Down Expand Up @@ -278,7 +278,6 @@ private void setMyCoops(UUID playerUUID, List<String> coops) {
* Can be used when clearer logs out or when they are kicked or leave a team
*
* @param clearer
* @param target
*/
public void clearMyInvitedCoops(Player clearer) {
//plugin.getLogger().info("DEBUG: clear my invited coops - clearing coops that were invited by " + clearer.getName());
Expand Down Expand Up @@ -311,7 +310,7 @@ public void clearMyInvitedCoops(Player clearer) {
/**
* Removes all coop players from an island - used when doing an island reset
*
* @param player
* @param island
*/
public void clearAllIslandCoops(Location island) {
if (island == null) {
Expand Down
8 changes: 8 additions & 0 deletions src/com/wasteofplastic/askyblock/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.List;
import java.util.Set;

import org.bukkit.Material;
import org.bukkit.block.Biome;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
Expand Down Expand Up @@ -224,6 +225,9 @@ public enum GameType {

// Use Economy
public static boolean useEconomy;

// Use Minishop
public static boolean useMinishop;

// Wait between being invited to same team island
public static int inviteWait;
Expand All @@ -237,6 +241,10 @@ public enum GameType {
// Need a certain amount of island levels to create a warp sign
public static int warpLevelsRestriction;

// Magic Cobble Generator
public static boolean useMagicCobbleGen;
public static HashMap<Material, Double> magicCobbleGenChances;

// Falling blocked commands
public static List<String> fallingCommandBlockList;
public static List<String> leaveCommands;
Expand Down
16 changes: 9 additions & 7 deletions src/com/wasteofplastic/askyblock/commands/IslandCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -821,19 +821,19 @@ public void run() {
if (!plugin.myLocale(player.getUniqueId()).islandSubTitle.isEmpty()) {
//plugin.getLogger().info("DEBUG: title " + player.getName() + " subtitle {\"text\":\"" + plugin.myLocale(player.getUniqueId()).islandSubTitle + "\", \"color\":\"" + plugin.myLocale(player.getUniqueId()).islandSubTitleColor + "\"}");
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(),
"title " + player.getName() + " subtitle {\"text\":\"" + plugin.myLocale(player.getUniqueId()).islandSubTitle + "\", \"color\":\"" + plugin.myLocale(player.getUniqueId()).islandSubTitleColor + "\"}");
"minecraft:title " + player.getName() + " subtitle {\"text\":\"" + plugin.myLocale(player.getUniqueId()).islandSubTitle + "\", \"color\":\"" + plugin.myLocale(player.getUniqueId()).islandSubTitleColor + "\"}");
}
if (!plugin.myLocale(player.getUniqueId()).islandTitle.isEmpty()) {
//plugin.getLogger().info("DEBUG: title " + player.getName() + " title {\"text\":\"" + plugin.myLocale(player.getUniqueId()).islandTitle + "\", \"color\":\"" + plugin.myLocale(player.getUniqueId()).islandTitleColor + "\"}");
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(),
"title " + player.getName() + " title {\"text\":\"" + plugin.myLocale(player.getUniqueId()).islandTitle + "\", \"color\":\"" + plugin.myLocale(player.getUniqueId()).islandTitleColor + "\"}");
"minecraft:title " + player.getName() + " title {\"text\":\"" + plugin.myLocale(player.getUniqueId()).islandTitle + "\", \"color\":\"" + plugin.myLocale(player.getUniqueId()).islandTitleColor + "\"}");
}
if (!plugin.myLocale(player.getUniqueId()).islandDonate.isEmpty() && !plugin.myLocale(player.getUniqueId()).islandURL.isEmpty()) {
//plugin.getLogger().info("DEBUG: tellraw " + player.getName() + " {\"text\":\"" + plugin.myLocale(player.getUniqueId()).islandDonate + "\",\"color\":\"" + plugin.myLocale(player.getUniqueId()).islandDonateColor + "\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\""
// + plugin.myLocale(player.getUniqueId()).islandURL + "\"}}");
plugin.getServer().dispatchCommand(
plugin.getServer().getConsoleSender(),
"tellraw " + player.getName() + " {\"text\":\"" + plugin.myLocale(player.getUniqueId()).islandDonate + "\",\"color\":\"" + plugin.myLocale(player.getUniqueId()).islandDonateColor + "\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\""
"minecraft:tellraw " + player.getName() + " {\"text\":\"" + plugin.myLocale(player.getUniqueId()).islandDonate + "\",\"color\":\"" + plugin.myLocale(player.getUniqueId()).islandDonateColor + "\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\""
+ plugin.myLocale(player.getUniqueId()).islandURL + "\"}}");
}
}
Expand Down Expand Up @@ -881,8 +881,7 @@ public void pasteSchematic(final Schematic schematic, final Location loc, final

/**
* Get the location of next free island spot
* @param player
*
* @param playerUUID
* @return Location of island spot
*/
private Location getNextIsland(UUID playerUUID) {
Expand Down Expand Up @@ -1013,7 +1012,7 @@ private Location nextGridLocation(final Location lastIsland) {
/**
* Calculates the island level
*
* @param asker
* @param sender
* - Player object of player who is asking
* @param targetPlayer
* - UUID of the player's island that is being requested
Expand Down Expand Up @@ -1418,7 +1417,7 @@ public boolean onCommand(final CommandSender sender, final Command command, fina
}

if (split[0].equalsIgnoreCase("minishop") || split[0].equalsIgnoreCase("ms")) {
if (Settings.useEconomy) {
if (Settings.useEconomy && Settings.useMinishop) {
// Check island
if (plugin.getGrid().getIsland(player.getUniqueId()) == null) {
player.sendMessage(ChatColor.RED + plugin.myLocale(player.getUniqueId()).errorNoIsland);
Expand All @@ -1434,6 +1433,9 @@ public boolean onCommand(final CommandSender sender, final Command command, fina
return true;
}
}
else{
player.sendMessage(ChatColor.RED + plugin.myLocale(player.getUniqueId()).errorMinishopDisabled);
}
}
// /island <command>
if (split[0].equalsIgnoreCase("warp")) {
Expand Down
3 changes: 2 additions & 1 deletion src/com/wasteofplastic/askyblock/listeners/ChatListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ private void teamChat(final AsyncPlayerChatEvent event, String message) {
}

/**
* @param Adds player to team chat
* Adds player to team chat
* @param playerUUID
*/
public void setPlayer(UUID playerUUID) {
this.teamChatUsers.put(playerUUID,true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void run() {

/**
* Track where the mob was created. This will determine its allowable movement zone.
* @param event
* @param e
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void mobSpawn(CreatureSpawnEvent e) {
Expand Down
Loading

0 comments on commit 054bfb2

Please sign in to comment.