This commit is contained in:
Indyuce 2022-06-04 12:10:01 +02:00
parent 560a2def41
commit 9a08c142fb
10 changed files with 38 additions and 53 deletions

View File

@ -39,7 +39,7 @@ import net.Indyuce.mmocore.manager.profession.*;
import net.Indyuce.mmocore.manager.social.BoosterManager;
import net.Indyuce.mmocore.manager.social.PartyManager;
import net.Indyuce.mmocore.manager.social.RequestManager;
import net.Indyuce.mmocore.party.PartyMemberTargetRestriction;
import net.Indyuce.mmocore.party.MMOCoreTargetRestriction;
import net.Indyuce.mmocore.party.PartyModule;
import net.Indyuce.mmocore.party.PartyModuleType;
import net.Indyuce.mmocore.party.provided.MMOCorePartyModule;
@ -116,7 +116,7 @@ public class MMOCore extends LuminePlugin {
}
// Register MMOCore-specific objects
MythicLib.plugin.getEntities().registerRestriction(new PartyMemberTargetRestriction());
MythicLib.plugin.getEntities().registerRestriction(new MMOCoreTargetRestriction());
MythicLib.plugin.getModifiers().registerModifierType("attribute", configObject -> new AttributeModifier(configObject));
// Register extra objective, drop items...

View File

@ -15,7 +15,7 @@ import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;
public class MineBlockExperienceSource extends SpecificExperienceSource<Material> {
public final Material material;
private final Material material;
private final boolean silkTouch;
private final boolean crop;

View File

@ -1,18 +1,14 @@
package net.Indyuce.mmocore.experience.source;
import com.mojang.datafixers.types.Func;
import io.lumine.mythic.lib.api.MMOLineConfig;
import io.lumine.mythic.lib.damage.DamageType;
import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser;
import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource;
import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerMoveEvent;
import org.xml.sax.SAXParseException;
import java.util.Arrays;
import java.util.Objects;
@ -20,9 +16,7 @@ import java.util.function.Function;
import java.util.stream.Collectors;
public class MoveExperienceSource extends SpecificExperienceSource {
MovingType type;
private final MovingType type;
public MoveExperienceSource(ExperienceDispenser dispenser, MMOLineConfig config) {
super(dispenser, config);

View File

@ -6,12 +6,13 @@ import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser;
import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource;
import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.Objects;
public class PlayExperienceSource extends SpecificExperienceSource {
private final World world;
@ -25,18 +26,9 @@ public class PlayExperienceSource extends SpecificExperienceSource {
*/
public PlayExperienceSource(ExperienceDispenser dispenser, MMOLineConfig config) {
super(dispenser, config);
if (!config.contains("in-combat"))
inCombat = false;
else {
inCombat = config.getBoolean("in-combat");
}
if (!config.contains("world"))
world = null;
else {
String name = config.getString("world");
Validate.notNull(world = Bukkit.getWorld(name), "Could not find world " + config.getString("world"));
}
inCombat = config.getBoolean("in-combat", false);
world = config.contains("world") ? Objects.requireNonNull(Bukkit.getWorld(config.getString("world")), "Could not find world " + config.getString("world")) : null;
if (!config.contains("x1") || !config.contains("x2")) {
x1 = Double.NEGATIVE_INFINITY;
x2 = Double.POSITIVE_INFINITY;

View File

@ -1,18 +1,17 @@
package net.Indyuce.mmocore.experience.source;
import de.schlichtherle.key.passwd.swing.BasicUnknownKeyFeedback;
import io.lumine.mythic.core.skills.mechanics.ShootMechanic;
import io.lumine.mythic.lib.api.MMOLineConfig;
import me.glaremasters.guilds.utils.BackupUtils;
import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser;
import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource;
import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.*;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Trident;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
@ -21,13 +20,10 @@ import org.bukkit.scheduler.BukkitRunnable;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
import java.util.function.Function;
import java.util.stream.Collectors;
public class ProjectileExperienceSource extends SpecificExperienceSource<Projectile> {
private final ProjectileType projectileType;
public ProjectileExperienceSource(ExperienceDispenser dispenser, MMOLineConfig config) {

View File

@ -17,7 +17,6 @@ import java.util.stream.Collectors;
public class ResourceExperienceSource extends SpecificExperienceSource<PlayerResource> {
private final PlayerResource resource;
/**
* Gives experience when the player uses a specific resoure. If no resource is precised it will trigger for
* mana, stamina and stellium. The amount specified si the xp given per resource consummed.

View File

@ -13,8 +13,6 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
public class TameExperienceSource extends SpecificExperienceSource {
public TameExperienceSource(ExperienceDispenser dispenser, MMOLineConfig config) {
super(dispenser, config);
}
@ -22,6 +20,7 @@ public class TameExperienceSource extends SpecificExperienceSource {
@Override
public ExperienceSourceManager<TameExperienceSource> newManager() {
return new ExperienceSourceManager<TameExperienceSource>() {
@EventHandler
public void onWolfHit(EntityDamageByEntityEvent e) {
if(e.getDamager() instanceof Wolf) {

View File

@ -7,7 +7,7 @@ import net.Indyuce.mmocore.api.player.PlayerData;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
public class PartyMemberTargetRestriction implements TargetRestriction {
public class MMOCoreTargetRestriction implements TargetRestriction {
@Override
public boolean canTarget(Player player, LivingEntity livingEntity, InteractionType interactionType) {
@ -15,6 +15,7 @@ public class PartyMemberTargetRestriction implements TargetRestriction {
return true;
AbstractParty party = MMOCore.plugin.partyModule.getParty(PlayerData.get(player));
// TODO check for guild
return party == null || !party.hasMember((Player) livingEntity);
}
}

View File

@ -1,13 +1,16 @@
package net.Indyuce.mmocore.party;
import net.Indyuce.mmocore.party.compat.*;
import net.Indyuce.mmocore.party.compat.DungeonsXLPartyModule;
import net.Indyuce.mmocore.party.compat.McMMOPartyModule;
import net.Indyuce.mmocore.party.compat.PAFPartyModule;
import net.Indyuce.mmocore.party.compat.PartiesPartyModule;
import net.Indyuce.mmocore.party.provided.MMOCorePartyModule;
import org.bukkit.Bukkit;
import javax.inject.Provider;
public enum PartyModuleType {
DUNGEONS("Dungeons", DungeonsPartyModule::new),
// DUNGEONS("Dungeons", DungeonsPartyModule::new),
DUNGEONSXL("DungeonsXL", DungeonsXLPartyModule::new),
MCMMO("mcMMO", McMMOPartyModule::new),
MMOCORE("MMOCore", MMOCorePartyModule::new),

View File

@ -55,7 +55,8 @@ protect-custom-mine: false
# - mmocore
# - dungeonsxl
# - parties
# - parties_and_friends
# - party_and_friends
# - mcmmo
party-plugin: mmocore
## Edit the plugin handling parties here.