WG API shouldn't be used unless WG is on version 7

This commit is contained in:
nossr50 2019-02-05 10:49:40 -08:00
parent 303a922165
commit e389c4b8f1
16 changed files with 41 additions and 30 deletions

View File

@ -7,6 +7,8 @@ Key:
! Change
- Removal
Version 2.1.8
mcMMO now checks for WG 7 before attempting to use the WG API
Made some optimizations for our WG integration
Fixed a bug where Bite chance for Master Angler was displaying too many decimal places
Fixed a bug where Abilities didn't check for permission nodes before activating
MaxBonusLevel now has specific entries for Standard and Retro in advanced.yml

View File

@ -11,7 +11,6 @@ import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.child.FamilyTree;
import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Player;

View File

@ -11,10 +11,8 @@ import com.gmail.nossr50.skills.fishing.FishingManager;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.TextComponentFactory;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.random.RandomChanceSkillStatic;
import com.gmail.nossr50.util.random.RandomChanceUtil;
import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;

View File

@ -17,7 +17,6 @@ import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.UUID;
public class Party {

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.listeners;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.HiddenConfig;
import com.gmail.nossr50.config.WorldBlacklist;
@ -19,7 +18,6 @@ import com.gmail.nossr50.skills.herbalism.HerbalismManager;
import com.gmail.nossr50.skills.mining.MiningManager;
import com.gmail.nossr50.skills.repair.Repair;
import com.gmail.nossr50.skills.salvage.Salvage;
import com.gmail.nossr50.skills.smelting.SmeltingManager;
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.EventUtils;
@ -36,7 +34,6 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Tag;
import org.bukkit.block.*;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;

View File

@ -10,7 +10,6 @@ import com.gmail.nossr50.datatypes.chat.ChatMode;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.ShareHandler;
@ -23,7 +22,6 @@ import com.gmail.nossr50.skills.repair.RepairManager;
import com.gmail.nossr50.skills.salvage.Salvage;
import com.gmail.nossr50.skills.salvage.SalvageManager;
import com.gmail.nossr50.skills.taming.TamingManager;
import com.gmail.nossr50.skills.unarmed.Unarmed;
import com.gmail.nossr50.util.*;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.SkillUtils;

View File

@ -33,7 +33,6 @@ import com.gmail.nossr50.skills.repair.repairables.SimpleRepairableManager;
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableManager;
import com.gmail.nossr50.skills.salvage.salvageables.SimpleSalvageableManager;
import com.gmail.nossr50.skills.smelting.SmeltingManager;
import com.gmail.nossr50.util.*;
import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManager;
import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManagerFactory;
@ -47,7 +46,6 @@ import com.gmail.nossr50.worldguard.WorldGuardManager;
import com.google.common.base.Charsets;
import net.shatteredlands.shatt.backup.ZipLibrary;
import org.bstats.bukkit.Metrics;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.metadata.FixedMetadataValue;

View File

@ -8,7 +8,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.skills.RankUtils;

View File

@ -11,8 +11,6 @@ import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.random.RandomChanceUtil;
import com.gmail.nossr50.util.skills.SkillUtils;
import com.gmail.nossr50.worldguard.WorldGuardManager;
import com.gmail.nossr50.worldguard.WorldGuardUtils;
import org.bukkit.Location;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Player;

View File

@ -2,8 +2,6 @@ package com.gmail.nossr50.skills.salvage;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.util.skills.RankUtils;
import org.bukkit.Material;
public class Salvage {

View File

@ -6,7 +6,6 @@ import com.gmail.nossr50.datatypes.experience.XPGainSource;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.skills.mining.Mining;
@ -21,17 +20,11 @@ import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.skills.SkillUtils;
import com.gmail.nossr50.util.sounds.SoundManager;
import com.gmail.nossr50.util.sounds.SoundType;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.FurnaceBurnEvent;
import org.bukkit.inventory.FurnaceRecipe;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.List;
public class SmeltingManager extends SkillManager {
public SmeltingManager(McMMOPlayer mcMMOPlayer) {

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.skills.taming;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.util.skills.RankUtils;
import org.bukkit.EntityEffect;
import org.bukkit.entity.*;

View File

@ -3,7 +3,6 @@ package com.gmail.nossr50.skills.unarmed;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.util.sounds.SoundManager;
import com.gmail.nossr50.util.sounds.SoundType;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.inventory.ItemStack;

View File

@ -6,7 +6,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
import com.gmail.nossr50.events.skills.secondaryabilities.SubSkillEvent;
import com.gmail.nossr50.events.skills.secondaryabilities.SubSkillRandomCheckEvent;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.SkillActivationType;

View File

@ -1,20 +1,38 @@
package com.gmail.nossr50.worldguard;
import com.gmail.nossr50.mcMMO;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import org.bukkit.plugin.Plugin;
import static org.bukkit.Bukkit.getServer;
public class WorldGuardUtils {
private static WorldGuardPlugin worldGuardPluginRef;
private static boolean isLoaded = false;
private static boolean hasWarned = false;
public static boolean isWorldGuardLoaded()
{
Plugin plugin = getServer().getPluginManager().getPlugin("WorldGuard");
WorldGuardPlugin plugin = getWorldGuard();
try {
// WorldGuard may not be loaded
if (plugin == null || !(plugin instanceof WorldGuardPlugin)) {
if (plugin == null) {
return false; // Maybe you want throw an exception instead
}
if(!WorldGuard.getVersion().startsWith("7"))
{
if(!hasWarned)
{
mcMMO.p.getLogger().severe("mcMMO only supports WorldGuard version 7! Make sure you have WG 7! This warning will not appear again.");
hasWarned = true;
}
return false; // WG 7 is required
}
} catch (Exception e) {
e.printStackTrace();
//Silently Fail
@ -22,6 +40,25 @@ public class WorldGuardUtils {
return false;
}
return true;
}
private static WorldGuardPlugin getWorldGuard()
{
if(isLoaded)
return worldGuardPluginRef;
Plugin plugin = getServer().getPluginManager().getPlugin("WorldGuard");
if(plugin instanceof WorldGuardPlugin)
{
worldGuardPluginRef = (WorldGuardPlugin) plugin;
if(worldGuardPluginRef != null)
isLoaded = true;
}
return worldGuardPluginRef;
}
}

View File

@ -236,7 +236,6 @@ Skills:
Herbalism:
GreenThumb:
# StageChange: Level value when the GreenThumb stage rank goes up
# ChanceMax: Maximum chance of GreenThumb when on <MaxBonusLevel> or higher
# MaxBonusLevel: On this level, GreenThumb chance will be <ChanceMax>
ChanceMax: 100.0