mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 06:06:45 +01:00
Pull master
This commit is contained in:
commit
f88dfe479e
@ -55,8 +55,16 @@ Version 2.2.000
|
||||
New Power Level Command
|
||||
This power level command gives you a view of all your current masteries, it also provides a summary of your power level.
|
||||
|
||||
Version 2.1.220
|
||||
Config files update automatically again
|
||||
Default configs are now copied to plugins/mcMMO/defaults for easy reference, these configs will always match the default values of the config in the JAR
|
||||
|
||||
Version 2.1.219
|
||||
Fixed Fishing exploit protection being triggered inappropriately by other plugins (Thanks smudgge)
|
||||
Fixed wiki url being incorrect in commands
|
||||
Party loading is more resilient (Thanks Wariorrrr)
|
||||
Fixed periods not being replaced whe nrenaming party (Thanks Wariorrrr)
|
||||
Fixed Party Teleport NPE (Thanks Wariorrrr)
|
||||
Added support for various new things from Minecraft 1.20
|
||||
Fixed double drop issue with Beetroots
|
||||
Added 'Camel' to taming experience in experience.yml
|
||||
|
@ -200,15 +200,19 @@ public class PartyCommand implements TabExecutor {
|
||||
|
||||
if (matches.size() == 0) {
|
||||
Player player = (Player) sender;
|
||||
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Not Loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
if(mcMMOPlayer == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
Party party = UserManager.getPlayer(player).getParty();
|
||||
if (mcMMOPlayer.getParty() == null)
|
||||
return ImmutableList.of();
|
||||
|
||||
final Party party = mcMMOPlayer.getParty();
|
||||
|
||||
playerNames = party.getOnlinePlayerNames(player);
|
||||
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<>(playerNames.size()));
|
||||
|
@ -25,7 +25,7 @@ public class PartyRenameCommand implements CommandExecutor {
|
||||
Party playerParty = mcMMOPlayer.getParty();
|
||||
|
||||
String oldPartyName = playerParty.getName();
|
||||
String newPartyName = args[1];
|
||||
String newPartyName = args[1].replace(".", "");
|
||||
|
||||
// This is to prevent party leaders from spamming other players with the rename message
|
||||
if (oldPartyName.equalsIgnoreCase(newPartyName)) {
|
||||
|
@ -10,22 +10,22 @@ import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class AutoUpdateConfigLoader extends ConfigLoader {
|
||||
public AutoUpdateConfigLoader(String relativePath, String fileName, File dataFolder) {
|
||||
public abstract class AutoUpdateLegacyConfigLoader extends LegacyConfigLoader {
|
||||
public AutoUpdateLegacyConfigLoader(String relativePath, String fileName, File dataFolder) {
|
||||
super(relativePath, fileName, dataFolder);
|
||||
}
|
||||
|
||||
public AutoUpdateConfigLoader(String fileName, File dataFolder) {
|
||||
public AutoUpdateLegacyConfigLoader(String fileName, File dataFolder) {
|
||||
super(fileName, dataFolder);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public AutoUpdateConfigLoader(String relativePath, String fileName) {
|
||||
public AutoUpdateLegacyConfigLoader(String relativePath, String fileName) {
|
||||
super(relativePath, fileName);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public AutoUpdateConfigLoader(String fileName) {
|
||||
public AutoUpdateLegacyConfigLoader(String fileName) {
|
||||
super(fileName);
|
||||
}
|
||||
|
@ -19,17 +19,7 @@ public abstract class BukkitConfig {
|
||||
protected YamlConfiguration defaultYamlConfig;
|
||||
protected YamlConfiguration config;
|
||||
protected @NotNull final File dataFolder;
|
||||
|
||||
public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder) {
|
||||
mcMMO.p.getLogger().info("[config] Initializing config: " + fileName);
|
||||
this.fileName = fileName;
|
||||
this.dataFolder = dataFolder;
|
||||
configFile = new File(dataFolder, fileName);
|
||||
this.defaultYamlConfig = copyDefaultConfig();
|
||||
this.config = initConfig();
|
||||
updateFile();
|
||||
mcMMO.p.getLogger().info("[config] Config initialized: " + fileName);
|
||||
}
|
||||
private boolean savedDefaults = false;
|
||||
|
||||
public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder, boolean copyDefaults) {
|
||||
mcMMO.p.getLogger().info("[config] Initializing config: " + fileName);
|
||||
@ -37,12 +27,16 @@ public abstract class BukkitConfig {
|
||||
this.fileName = fileName;
|
||||
this.dataFolder = dataFolder;
|
||||
configFile = new File(dataFolder, fileName);
|
||||
this.defaultYamlConfig = copyDefaultConfig();
|
||||
this.defaultYamlConfig = saveDefaultConfigToDisk();
|
||||
this.config = initConfig();
|
||||
updateFile();
|
||||
mcMMO.p.getLogger().info("[config] Config initialized: " + fileName);
|
||||
}
|
||||
|
||||
public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder) {
|
||||
this(fileName, dataFolder, true);
|
||||
}
|
||||
|
||||
public BukkitConfig(@NotNull String fileName) {
|
||||
this(fileName, mcMMO.p.getDataFolder());
|
||||
}
|
||||
@ -55,10 +49,12 @@ public abstract class BukkitConfig {
|
||||
*/
|
||||
public void updateFile() {
|
||||
try {
|
||||
if(copyDefaults) {
|
||||
copyMissingDefaultsFromResource();
|
||||
}
|
||||
config.save(configFile);
|
||||
|
||||
if(copyDefaults && !savedDefaults) {
|
||||
copyMissingDefaultsFromResource();
|
||||
savedDefaults = true;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -84,7 +80,7 @@ public abstract class BukkitConfig {
|
||||
/**
|
||||
* Copies the config from the JAR to defaults/<fileName>
|
||||
*/
|
||||
YamlConfiguration copyDefaultConfig() {
|
||||
YamlConfiguration saveDefaultConfigToDisk() {
|
||||
mcMMO.p.getLogger().info("[config] Copying default config to disk: " + fileName + " to defaults/" + fileName);
|
||||
try(InputStream inputStream = mcMMO.p.getResource(fileName)) {
|
||||
if(inputStream == null) {
|
||||
|
@ -7,20 +7,21 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ConfigLoader {
|
||||
@Deprecated
|
||||
public abstract class LegacyConfigLoader {
|
||||
protected final File configFile;
|
||||
protected final @NotNull File dataFolder;
|
||||
protected String fileName;
|
||||
protected YamlConfiguration config;
|
||||
|
||||
public ConfigLoader(String relativePath, String fileName, @NotNull File dataFolder) {
|
||||
public LegacyConfigLoader(String relativePath, String fileName, @NotNull File dataFolder) {
|
||||
this.fileName = fileName;
|
||||
this.dataFolder = dataFolder;
|
||||
configFile = new File(dataFolder, relativePath + File.separator + fileName);
|
||||
loadFile();
|
||||
}
|
||||
|
||||
public ConfigLoader(String fileName, @NotNull File dataFolder) {
|
||||
public LegacyConfigLoader(String fileName, @NotNull File dataFolder) {
|
||||
this.fileName = fileName;
|
||||
this.dataFolder = dataFolder;
|
||||
configFile = new File(dataFolder, fileName);
|
||||
@ -28,7 +29,7 @@ public abstract class ConfigLoader {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ConfigLoader(String relativePath, String fileName) {
|
||||
public LegacyConfigLoader(String relativePath, String fileName) {
|
||||
this.fileName = fileName;
|
||||
configFile = new File(mcMMO.p.getDataFolder(), relativePath + File.separator + fileName);
|
||||
this.dataFolder = mcMMO.p.getDataFolder();
|
||||
@ -36,7 +37,7 @@ public abstract class ConfigLoader {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ConfigLoader(String fileName) {
|
||||
public LegacyConfigLoader(String fileName) {
|
||||
this.fileName = fileName;
|
||||
configFile = new File(mcMMO.p.getDataFolder(), fileName);
|
||||
this.dataFolder = mcMMO.p.getDataFolder();
|
@ -9,7 +9,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
public class RankConfig extends AutoUpdateConfigLoader {
|
||||
public class RankConfig extends BukkitConfig {
|
||||
private static RankConfig instance;
|
||||
|
||||
public RankConfig() {
|
||||
@ -66,7 +66,7 @@ public class RankConfig extends AutoUpdateConfigLoader {
|
||||
*/
|
||||
public int getSubSkillUnlockLevel(SubSkillType subSkillType, int rank, boolean retroMode) {
|
||||
String key = getRankAddressKey(subSkillType, rank, retroMode);
|
||||
return config.getInt(key, getInternalConfig().getInt(key));
|
||||
return config.getInt(key, defaultYamlConfig.getInt(key));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -128,7 +128,7 @@ public class RankConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
private void resetRankValue(@NotNull SubSkillType subSkillType, int rank, boolean retroMode) {
|
||||
String key = getRankAddressKey(subSkillType, rank, retroMode);
|
||||
int defaultValue = getInternalConfig().getInt(key);
|
||||
int defaultValue = defaultYamlConfig.getInt(key);
|
||||
config.set(key, defaultValue);
|
||||
mcMMO.p.getLogger().info(key + " SET -> " + defaultValue);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class ArmorConfigManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
modManager.registerCustomArmor(new CustomArmorConfig(fileName));
|
||||
modManager.registerCustomArmor(new CustomArmorLegacyConfig(fileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class BlockConfigManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
modManager.registerCustomBlocks(new CustomBlockConfig(fileName));
|
||||
modManager.registerCustomBlocks(new CustomBlockLegacyConfig(fileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.gmail.nossr50.config.mods;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.config.LegacyConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@ -13,7 +13,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class CustomArmorConfig extends ConfigLoader {
|
||||
public class CustomArmorLegacyConfig extends LegacyConfigLoader {
|
||||
public List<Material> customBoots = new ArrayList<>();
|
||||
public List<Material> customChestplates = new ArrayList<>();
|
||||
public List<Material> customHelmets = new ArrayList<>();
|
||||
@ -21,7 +21,7 @@ public class CustomArmorConfig extends ConfigLoader {
|
||||
public List<Repairable> repairables = new ArrayList<>();
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
protected CustomArmorConfig(String fileName) {
|
||||
protected CustomArmorLegacyConfig(String fileName) {
|
||||
super("mods", fileName);
|
||||
loadKeys();
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package com.gmail.nossr50.config.mods;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.config.LegacyConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.Material;
|
||||
@ -11,7 +11,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class CustomBlockConfig extends ConfigLoader {
|
||||
public class CustomBlockLegacyConfig extends LegacyConfigLoader {
|
||||
public List<Material> customExcavationBlocks = new ArrayList<>();
|
||||
public List<Material> customHerbalismBlocks = new ArrayList<>();
|
||||
public List<Material> customMiningBlocks = new ArrayList<>();
|
||||
@ -22,7 +22,7 @@ public class CustomBlockConfig extends ConfigLoader {
|
||||
public HashMap<Material, CustomBlock> customBlockMap = new HashMap<>();
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
protected CustomBlockConfig(String fileName) {
|
||||
protected CustomBlockLegacyConfig(String fileName) {
|
||||
super("mods", fileName);
|
||||
loadKeys();
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package com.gmail.nossr50.config.mods;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.config.LegacyConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomEntity;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.apache.commons.lang.ClassUtils;
|
||||
@ -9,11 +9,11 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class CustomEntityConfig extends ConfigLoader {
|
||||
public class CustomEntityLegacyConfig extends LegacyConfigLoader {
|
||||
public HashMap<String, CustomEntity> customEntityClassMap = new HashMap<>();
|
||||
public HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<>();
|
||||
|
||||
protected CustomEntityConfig(String fileName) {
|
||||
protected CustomEntityLegacyConfig(String fileName) {
|
||||
super("mods", fileName);
|
||||
loadKeys();
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package com.gmail.nossr50.config.mods;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.config.LegacyConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomTool;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
@ -15,7 +15,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class CustomToolConfig extends ConfigLoader {
|
||||
public class CustomToolLegacyConfig extends LegacyConfigLoader {
|
||||
public List<Material> customAxes = new ArrayList<>();
|
||||
public List<Material> customBows = new ArrayList<>();
|
||||
public List<Material> customHoes = new ArrayList<>();
|
||||
@ -26,7 +26,7 @@ public class CustomToolConfig extends ConfigLoader {
|
||||
public List<Repairable> repairables = new ArrayList<>();
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
protected CustomToolConfig(String fileName) {
|
||||
protected CustomToolLegacyConfig(String fileName) {
|
||||
super("mods", fileName);
|
||||
loadKeys();
|
||||
}
|
@ -29,7 +29,7 @@ public class EntityConfigManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
modManager.registerCustomEntities(new CustomEntityConfig(fileName));
|
||||
modManager.registerCustomEntities(new CustomEntityLegacyConfig(fileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class ToolConfigManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
modManager.registerCustomTools(new CustomToolConfig(fileName));
|
||||
modManager.registerCustomTools(new CustomToolLegacyConfig(fileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.gmail.nossr50.config.skills.alchemy;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.config.LegacyConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -15,7 +15,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class PotionConfig extends ConfigLoader {
|
||||
public class PotionConfig extends LegacyConfigLoader {
|
||||
private static PotionConfig instance;
|
||||
|
||||
private final List<ItemStack> concoctionsIngredientsTierOne = new ArrayList<>();
|
||||
|
@ -17,8 +17,8 @@ public class RepairConfig extends BukkitConfig {
|
||||
private final HashSet<String> notSupported;
|
||||
private List<Repairable> repairables;
|
||||
|
||||
public RepairConfig(String fileName) {
|
||||
super(fileName, false);
|
||||
public RepairConfig(String fileName, boolean copyDefaults) {
|
||||
super(fileName, copyDefaults);
|
||||
notSupported = new HashSet<>();
|
||||
loadKeys();
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public class RepairConfigManager {
|
||||
Pattern pattern = Pattern.compile("repair\\.(?:.+)\\.yml");
|
||||
File dataFolder = plugin.getDataFolder();
|
||||
|
||||
RepairConfig mainRepairConfig = new RepairConfig(REPAIR_VANILLA_YML);
|
||||
RepairConfig mainRepairConfig = new RepairConfig(REPAIR_VANILLA_YML, true);
|
||||
repairables.addAll(mainRepairConfig.getLoadedRepairables());
|
||||
|
||||
for (String fileName : dataFolder.list()) {
|
||||
@ -33,7 +33,7 @@ public class RepairConfigManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
RepairConfig rConfig = new RepairConfig(fileName);
|
||||
RepairConfig rConfig = new RepairConfig(fileName, false);
|
||||
repairables.addAll(rConfig.getLoadedRepairables());
|
||||
}
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ public class SalvageConfig extends BukkitConfig {
|
||||
private final HashSet<String> notSupported;
|
||||
private Set<Salvageable> salvageables;
|
||||
|
||||
public SalvageConfig(String fileName) {
|
||||
super(fileName);
|
||||
public SalvageConfig(String fileName, boolean copyDefaults) {
|
||||
super(fileName, copyDefaults);
|
||||
notSupported = new HashSet<>();
|
||||
loadKeys();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public class SalvageConfigManager {
|
||||
Pattern pattern = Pattern.compile("salvage\\.(?:.+)\\.yml");
|
||||
File dataFolder = plugin.getDataFolder();
|
||||
|
||||
SalvageConfig mainSalvageConfig = new SalvageConfig(SALVAGE_VANILLA_YML);
|
||||
SalvageConfig mainSalvageConfig = new SalvageConfig(SALVAGE_VANILLA_YML, true);
|
||||
salvageables.addAll(mainSalvageConfig.getLoadedSalvageables());
|
||||
|
||||
for (String fileName : dataFolder.list()) {
|
||||
@ -34,7 +34,7 @@ public class SalvageConfigManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
SalvageConfig salvageConfig = new SalvageConfig(fileName);
|
||||
SalvageConfig salvageConfig = new SalvageConfig(fileName, false);
|
||||
salvageables.addAll(salvageConfig.getLoadedSalvageables());
|
||||
}
|
||||
}
|
||||
|
@ -450,6 +450,9 @@ public class PlayerListener implements Listener {
|
||||
case CAUGHT_FISH:
|
||||
if(caught instanceof Item) {
|
||||
if(ExperienceConfig.getInstance().isFishingExploitingPrevented()) {
|
||||
|
||||
fishingManager.processExploiting(event.getHook().getLocation().toVector());
|
||||
|
||||
if (fishingManager.isExploitingFishing(event.getHook().getLocation().toVector())) {
|
||||
player.sendMessage(LocaleLoader.getString("Fishing.ScarcityTip", ExperienceConfig.getInstance().getFishingExploitingOptionMoveRange()));
|
||||
event.setExpToDrop(0);
|
||||
|
@ -28,6 +28,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public final class PartyManager {
|
||||
private static final String partiesFilePath = mcMMO.getFlatFileDirectory() + "parties.yml";
|
||||
@ -609,34 +610,38 @@ public final class PartyManager {
|
||||
ArrayList<Party> hasAlly = new ArrayList<>();
|
||||
|
||||
for (String partyName : partiesFile.getConfigurationSection("").getKeys(false)) {
|
||||
Party party = new Party(partyName);
|
||||
try {
|
||||
Party party = new Party(partyName);
|
||||
|
||||
String[] leaderSplit = partiesFile.getString(partyName + ".Leader").split("[|]");
|
||||
party.setLeader(new PartyLeader(UUID.fromString(leaderSplit[0]), leaderSplit[1]));
|
||||
party.setPassword(partiesFile.getString(partyName + ".Password"));
|
||||
party.setLocked(partiesFile.getBoolean(partyName + ".Locked"));
|
||||
party.setLevel(partiesFile.getInt(partyName + ".Level"));
|
||||
party.setXp(partiesFile.getInt(partyName + ".Xp"));
|
||||
String[] leaderSplit = partiesFile.getString(partyName + ".Leader").split("[|]");
|
||||
party.setLeader(new PartyLeader(UUID.fromString(leaderSplit[0]), leaderSplit[1]));
|
||||
party.setPassword(partiesFile.getString(partyName + ".Password"));
|
||||
party.setLocked(partiesFile.getBoolean(partyName + ".Locked"));
|
||||
party.setLevel(partiesFile.getInt(partyName + ".Level"));
|
||||
party.setXp(partiesFile.getInt(partyName + ".Xp"));
|
||||
|
||||
if (partiesFile.getString(partyName + ".Ally") != null) {
|
||||
hasAlly.add(party);
|
||||
if (partiesFile.getString(partyName + ".Ally") != null) {
|
||||
hasAlly.add(party);
|
||||
}
|
||||
|
||||
party.setXpShareMode(ShareMode.getShareMode(partiesFile.getString(partyName + ".ExpShareMode", "NONE")));
|
||||
party.setItemShareMode(ShareMode.getShareMode(partiesFile.getString(partyName + ".ItemShareMode", "NONE")));
|
||||
|
||||
for (ItemShareType itemShareType : ItemShareType.values()) {
|
||||
party.setSharingDrops(itemShareType, partiesFile.getBoolean(partyName + ".ItemShareType." + itemShareType.toString(), true));
|
||||
}
|
||||
|
||||
LinkedHashMap<UUID, String> members = party.getMembers();
|
||||
|
||||
for (String memberEntry : partiesFile.getStringList(partyName + ".Members")) {
|
||||
String[] memberSplit = memberEntry.split("[|]");
|
||||
members.put(UUID.fromString(memberSplit[0]), memberSplit[1]);
|
||||
}
|
||||
|
||||
parties.add(party);
|
||||
} catch (Exception e) {
|
||||
mcMMO.p.getLogger().log(Level.WARNING, "An exception occurred while loading a party with name '" + partyName + "'. Skipped loading party.", e);
|
||||
}
|
||||
|
||||
party.setXpShareMode(ShareMode.getShareMode(partiesFile.getString(partyName + ".ExpShareMode", "NONE")));
|
||||
party.setItemShareMode(ShareMode.getShareMode(partiesFile.getString(partyName + ".ItemShareMode", "NONE")));
|
||||
|
||||
for (ItemShareType itemShareType : ItemShareType.values()) {
|
||||
party.setSharingDrops(itemShareType, partiesFile.getBoolean(partyName + ".ItemShareType." + itemShareType.toString(), true));
|
||||
}
|
||||
|
||||
LinkedHashMap<UUID, String> members = party.getMembers();
|
||||
|
||||
for (String memberEntry : partiesFile.getStringList(partyName + ".Members")) {
|
||||
String[] memberSplit = memberEntry.split("[|]");
|
||||
members.put(UUID.fromString(memberSplit[0]), memberSplit[1]);
|
||||
}
|
||||
|
||||
parties.add(party);
|
||||
}
|
||||
|
||||
mcMMO.p.debug("Loaded (" + parties.size() + ") Parties...");
|
||||
|
@ -50,6 +50,7 @@ public class FishingManager extends SkillManager {
|
||||
private long lastWarnedExhaust = 0L;
|
||||
private FishHook fishHookReference;
|
||||
private BoundingBox lastFishingBoundingBox;
|
||||
private boolean sameTarget;
|
||||
private Item fishingCatch;
|
||||
private Location hookLocation;
|
||||
private int fishCaughtCounter = 1;
|
||||
@ -127,6 +128,25 @@ public class FishingManager extends SkillManager {
|
||||
return hasFished;
|
||||
}
|
||||
|
||||
public void processExploiting(Vector centerOfCastVector) {
|
||||
BoundingBox newCastBoundingBox = makeBoundingBox(centerOfCastVector);
|
||||
this.sameTarget = lastFishingBoundingBox != null && lastFishingBoundingBox.overlaps(newCastBoundingBox);
|
||||
|
||||
if (this.sameTarget) {
|
||||
fishCaughtCounter++;
|
||||
}
|
||||
else {
|
||||
fishCaughtCounter = 1;
|
||||
}
|
||||
|
||||
//If the new bounding box does not intersect with the old one, then update our bounding box reference
|
||||
if (!this.sameTarget) lastFishingBoundingBox = newCastBoundingBox;
|
||||
|
||||
if (fishCaughtCounter + 1 == ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit()) {
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Fishing.LowResourcesTip", ExperienceConfig.getInstance().getFishingExploitingOptionMoveRange()));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isExploitingFishing(Vector centerOfCastVector) {
|
||||
|
||||
/*Block targetBlock = getPlayer().getTargetBlock(BlockUtils.getTransparentBlocks(), 100);
|
||||
@ -135,25 +155,7 @@ public class FishingManager extends SkillManager {
|
||||
return false;
|
||||
}*/
|
||||
|
||||
BoundingBox newCastBoundingBox = makeBoundingBox(centerOfCastVector);
|
||||
|
||||
boolean sameTarget = lastFishingBoundingBox != null && lastFishingBoundingBox.overlaps(newCastBoundingBox);
|
||||
|
||||
if(sameTarget)
|
||||
fishCaughtCounter++;
|
||||
else
|
||||
fishCaughtCounter = 1;
|
||||
|
||||
if(fishCaughtCounter + 1 == ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit())
|
||||
{
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Fishing.LowResourcesTip", ExperienceConfig.getInstance().getFishingExploitingOptionMoveRange()));
|
||||
}
|
||||
|
||||
//If the new bounding box does not intersect with the old one, then update our bounding box reference
|
||||
if(!sameTarget)
|
||||
lastFishingBoundingBox = newCastBoundingBox;
|
||||
|
||||
return sameTarget && fishCaughtCounter >= ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit();
|
||||
return this.sameTarget && fishCaughtCounter >= ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit();
|
||||
}
|
||||
|
||||
public static BoundingBox makeBoundingBox(Vector centerOfCastVector) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.gmail.nossr50.util;
|
||||
|
||||
import com.gmail.nossr50.config.mods.CustomArmorConfig;
|
||||
import com.gmail.nossr50.config.mods.CustomBlockConfig;
|
||||
import com.gmail.nossr50.config.mods.CustomEntityConfig;
|
||||
import com.gmail.nossr50.config.mods.CustomToolConfig;
|
||||
import com.gmail.nossr50.config.mods.CustomArmorLegacyConfig;
|
||||
import com.gmail.nossr50.config.mods.CustomBlockLegacyConfig;
|
||||
import com.gmail.nossr50.config.mods.CustomEntityLegacyConfig;
|
||||
import com.gmail.nossr50.config.mods.CustomToolLegacyConfig;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomEntity;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomTool;
|
||||
@ -52,7 +52,7 @@ public class ModManager {
|
||||
private final List<Material> customSwords = new ArrayList<>();
|
||||
private final HashMap<Material, CustomTool> customToolMap = new HashMap<>();
|
||||
|
||||
public void registerCustomArmor(CustomArmorConfig config) {
|
||||
public void registerCustomArmor(CustomArmorLegacyConfig config) {
|
||||
customBoots.addAll(config.customBoots);
|
||||
customChestplates.addAll(config.customChestplates);
|
||||
customHelmets.addAll(config.customHelmets);
|
||||
@ -60,7 +60,7 @@ public class ModManager {
|
||||
repairables.addAll(config.repairables);
|
||||
}
|
||||
|
||||
public void registerCustomBlocks(CustomBlockConfig config) {
|
||||
public void registerCustomBlocks(CustomBlockLegacyConfig config) {
|
||||
customExcavationBlocks.addAll(config.customExcavationBlocks);
|
||||
customHerbalismBlocks.addAll(config.customHerbalismBlocks);
|
||||
customMiningBlocks.addAll(config.customMiningBlocks);
|
||||
@ -71,12 +71,12 @@ public class ModManager {
|
||||
customBlockMap.putAll(config.customBlockMap);
|
||||
}
|
||||
|
||||
public void registerCustomEntities(CustomEntityConfig config) {
|
||||
public void registerCustomEntities(CustomEntityLegacyConfig config) {
|
||||
customEntityClassMap.putAll(config.customEntityClassMap);
|
||||
customEntityTypeMap.putAll(config.customEntityTypeMap);
|
||||
}
|
||||
|
||||
public void registerCustomTools(CustomToolConfig config) {
|
||||
public void registerCustomTools(CustomToolLegacyConfig config) {
|
||||
customAxes.addAll(config.customAxes);
|
||||
customBows.addAll(config.customBows);
|
||||
customHoes.addAll(config.customHoes);
|
||||
|
Loading…
Reference in New Issue
Block a user