Skip to content

Commit

Permalink
Changed how island deletion is done to reduce lag.
Browse files Browse the repository at this point in the history
Added protection for End Crystals for V1.9 servers.
  • Loading branch information
tastybento committed Mar 13, 2016
1 parent f9200f0 commit d09f9c5
Show file tree
Hide file tree
Showing 16 changed files with 455 additions and 222 deletions.
2 changes: 2 additions & 0 deletions challenges.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ challenges:
# Challenge levels - list as many as you like. If a challenge's level is '' it can
# be done anytime.
levels: 'Novice Competent Expert Advanced Elite'
# Free levels - which levels above should be freely available
freelevels: ''

# The number of undone tasks that can be left on a level before unlocking next level
waiveramount: 1
Expand Down
1 change: 0 additions & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,6 @@ biomes:
permission: askyblock.biomes.hell
friendlyname: Nether
description: "Warning - all water, snow and ice will be removed."
#permission: any.perm.you.want
JUNGLE:
icon: VINE
description: "Lush jungle. Warning - Ice or snow have to go."
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,5 @@
<url>http://maven.sk89q.com/repo/</url>
</repository>
</repositories>
<version>3.0.0.1</version>
<version>3.0.0.2</version>
</project>
17 changes: 15 additions & 2 deletions src/com/wasteofplastic/askyblock/ASkyBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
import com.wasteofplastic.askyblock.listeners.ChatListener;
import com.wasteofplastic.askyblock.listeners.HeroChatListener;
import com.wasteofplastic.askyblock.listeners.IslandGuard;
import com.wasteofplastic.askyblock.listeners.IslandGuardNew;
import com.wasteofplastic.askyblock.listeners.IslandGuard1_8;
import com.wasteofplastic.askyblock.listeners.IslandGuard1_9;
import com.wasteofplastic.askyblock.listeners.JoinLeaveEvents;
import com.wasteofplastic.askyblock.listeners.LavaCheck;
import com.wasteofplastic.askyblock.listeners.NetherPortals;
Expand Down Expand Up @@ -256,6 +257,7 @@ public void onEnable() {
if (clazz != null) {
onePointEight = true;
}

saveDefaultConfig();
// Check to see if island distance is set or not
if (getConfig().getInt("island.distance", -1) < 1) {
Expand Down Expand Up @@ -1393,6 +1395,10 @@ public boolean loadPluginConfig() {
Settings.addCompletedGlow = getConfig().getBoolean("general.addcompletedglow", true);
// Clean up blocks around edges when deleting islands
Settings.cleanUpBlocks = getConfig().getBoolean("island.cleanupblocks",false);
Settings.cleanRate = getConfig().getInt("island.cleanrate", 2);
if (Settings.cleanRate < 1) {
Settings.cleanRate = 1;
}
// No acid bottles or buckets
Settings.acidBottle = getConfig().getBoolean("general.acidbottles", true);
// All done
Expand All @@ -1413,7 +1419,14 @@ public void registerEvents() {
manager.registerEvents(new PlayerEvents(this), this);
// New V1.8 events
if (onePointEight) {
manager.registerEvents(new IslandGuardNew(this), this);
manager.registerEvents(new IslandGuard1_8(this), this);
}
// Check for 1.9 material
for (Material m : Material.values()) {
if (m.name().equalsIgnoreCase("END_CRYSTAL")) {
manager.registerEvents(new IslandGuard1_9(this), this);
break;
}
}
// Events for when a player joins or leaves the server
manager.registerEvents(new JoinLeaveEvents(this), this);
Expand Down
356 changes: 153 additions & 203 deletions src/com/wasteofplastic/askyblock/DeleteIslandChunk.java

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions src/com/wasteofplastic/askyblock/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

Expand All @@ -38,7 +39,7 @@ public class Settings {
public enum GameType {
ASKYBLOCK, ACIDISLAND
}
/*

public final static GameType GAMETYPE = GameType.ACIDISLAND;
// The spawn command (Essentials spawn for example)
public final static String SPAWNCOMMAND = "spawn";
Expand All @@ -50,7 +51,7 @@ public enum GameType {
public static final String CHALLENGECOMMAND = "aic";
// Admin command
public static final String ADMINCOMMAND = "acid";
*/
/*
public final static GameType GAMETYPE = GameType.ASKYBLOCK;
// Permission prefix
public final static String PERMPREFIX = "askyblock.";
Expand All @@ -62,7 +63,7 @@ public enum GameType {
public final static String SPAWNCOMMAND = "spawn";
// Admin command
public static final String ADMINCOMMAND = "asadmin";

*/
public static Set<String> challengeList;
public static int waiverAmount;
public static List<String> challengeLevels;
Expand Down Expand Up @@ -266,4 +267,6 @@ public enum GameType {
public static boolean cleanUpBlocks;
public static boolean acidBottle;
public static boolean useOwnGenerator;
public static List<String> freeLevels = new ArrayList<String>();
public static int cleanRate;
}
4 changes: 2 additions & 2 deletions src/com/wasteofplastic/askyblock/commands/AdminCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@
import com.wasteofplastic.askyblock.DeleteIslandChunk;
import com.wasteofplastic.askyblock.GridManager;
import com.wasteofplastic.askyblock.Island;
import com.wasteofplastic.askyblock.Island.Flags;
import com.wasteofplastic.askyblock.PlayerCache;
import com.wasteofplastic.askyblock.SafeSpotTeleport;
import com.wasteofplastic.askyblock.Settings;
import com.wasteofplastic.askyblock.Settings.GameType;
import com.wasteofplastic.askyblock.TopTen;
import com.wasteofplastic.askyblock.Island.Flags;
import com.wasteofplastic.askyblock.Settings.GameType;
import com.wasteofplastic.askyblock.panels.ControlPanel;
import com.wasteofplastic.askyblock.util.Util;
import com.wasteofplastic.askyblock.util.VaultHelper;
Expand Down
6 changes: 5 additions & 1 deletion src/com/wasteofplastic/askyblock/commands/Challenges.java
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,9 @@ private void givePotion(Player player, List<ItemStack> rewardedItems, String[] e
* @return int of challenges that must still be completed to finish level.
*/
public int checkLevelCompletion(final Player player, final String level) {
if (Settings.freeLevels.contains(level)) {
return 0;
}
int challengesCompleted = 0;
List<String> levelChallengeList = challengeList.get(level);
int waiver = Settings.waiverAmount;
Expand Down Expand Up @@ -1822,7 +1825,8 @@ public void reloadChallengeConfig() {
challengeFile.setDefaults(defConfig);
}
Settings.challengeList = getChallengeConfig().getConfigurationSection("challenges.challengeList").getKeys(false);
Settings.challengeLevels = Arrays.asList(getChallengeConfig().getString("challenges.levels").split(" "));
Settings.challengeLevels = Arrays.asList(getChallengeConfig().getString("challenges.levels","").split(" "));
Settings.freeLevels = Arrays.asList(getChallengeConfig().getString("challenges.freelevels","").split(" "));
Settings.waiverAmount = getChallengeConfig().getInt("challenges.waiveramount", 1);
if (Settings.waiverAmount < 0) {
Settings.waiverAmount = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/com/wasteofplastic/askyblock/commands/IslandCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@
import com.wasteofplastic.askyblock.DeleteIslandChunk;
import com.wasteofplastic.askyblock.GridManager;
import com.wasteofplastic.askyblock.Island;
import com.wasteofplastic.askyblock.Island.Flags;
import com.wasteofplastic.askyblock.LevelCalc;
import com.wasteofplastic.askyblock.LevelCalcByChunk;
import com.wasteofplastic.askyblock.Settings;
import com.wasteofplastic.askyblock.TopTen;
import com.wasteofplastic.askyblock.Island.Flags;
import com.wasteofplastic.askyblock.events.IslandJoinEvent;
import com.wasteofplastic.askyblock.events.IslandLeaveEvent;
import com.wasteofplastic.askyblock.events.IslandNewEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@

import com.wasteofplastic.askyblock.ASkyBlock;
import com.wasteofplastic.askyblock.Island;
import com.wasteofplastic.askyblock.Island.Flags;
import com.wasteofplastic.askyblock.SafeBoat;
import com.wasteofplastic.askyblock.Settings;
import com.wasteofplastic.askyblock.Island.Flags;
import com.wasteofplastic.askyblock.events.IslandEnterEvent;
import com.wasteofplastic.askyblock.events.IslandExitEvent;
import com.wasteofplastic.askyblock.util.Util;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

import com.wasteofplastic.askyblock.ASkyBlock;
import com.wasteofplastic.askyblock.Island;
import com.wasteofplastic.askyblock.Island.Flags;
import com.wasteofplastic.askyblock.Settings;
import com.wasteofplastic.askyblock.Island.Flags;
import com.wasteofplastic.askyblock.util.Util;
import com.wasteofplastic.askyblock.util.VaultHelper;

Expand All @@ -43,11 +43,11 @@
* Provides protection to islands - handles newer events that may not
* exist in older servers
*/
public class IslandGuardNew implements Listener {
public class IslandGuard1_8 implements Listener {
private final ASkyBlock plugin;
private final boolean debug = false;

public IslandGuardNew(final ASkyBlock plugin) {
public IslandGuard1_8(final ASkyBlock plugin) {
this.plugin = plugin;

}
Expand Down
Loading

0 comments on commit d09f9c5

Please sign in to comment.