mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 06:06:45 +01:00
Fun with arrows
This commit is contained in:
parent
967ffd6442
commit
9360e147ac
@ -2,11 +2,7 @@ package com.gmail.nossr50.commands.skills;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
|
||||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
|
||||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -31,7 +27,7 @@ public class TridentsCommand extends SkillCommand {
|
|||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||||
List<String> messages = new ArrayList<>();
|
List<String> messages = new ArrayList<>();
|
||||||
|
|
||||||
if (canUseSubskill(player, SubSkillType.TRIDENTS_TRIDENTS_SUPER_ABILITY)) {
|
if (canUseSubskill(player, SubSkillType.TRIDENTS_SUPER)) {
|
||||||
messages.add("Tridents Super Ability");
|
messages.add("Tridents Super Ability");
|
||||||
//TODO: Implement Tridents Super
|
//TODO: Implement Tridents Super
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ public enum SubSkillType {
|
|||||||
/* CROSSBOWS */
|
/* CROSSBOWS */
|
||||||
CROSSBOWS_SUPER_SHOTGUN(1),
|
CROSSBOWS_SUPER_SHOTGUN(1),
|
||||||
CROSSBOWS_CROSSBOWS_LIMIT_BREAK(10),
|
CROSSBOWS_CROSSBOWS_LIMIT_BREAK(10),
|
||||||
|
CROSSBOWS_TRICK_SHOT(5),
|
||||||
|
|
||||||
/* Excavation */
|
/* Excavation */
|
||||||
EXCAVATION_ARCHAEOLOGY(8),
|
EXCAVATION_ARCHAEOLOGY(8),
|
||||||
@ -99,7 +100,7 @@ public enum SubSkillType {
|
|||||||
TAMING_THICK_FUR(1),
|
TAMING_THICK_FUR(1),
|
||||||
|
|
||||||
/* Tridents */
|
/* Tridents */
|
||||||
TRIDENTS_TRIDENTS_SUPER_ABILITY(1),
|
TRIDENTS_SUPER(1),
|
||||||
TRIDENTS_TRIDENTS_LIMIT_BREAK(10),
|
TRIDENTS_TRIDENTS_LIMIT_BREAK(10),
|
||||||
|
|
||||||
/* Unarmed */
|
/* Unarmed */
|
||||||
|
@ -112,7 +112,7 @@ public enum SuperAbilityType {
|
|||||||
TREE_FELLER.subSkillTypeDefinition = SubSkillType.WOODCUTTING_TREE_FELLER;
|
TREE_FELLER.subSkillTypeDefinition = SubSkillType.WOODCUTTING_TREE_FELLER;
|
||||||
SERRATED_STRIKES.subSkillTypeDefinition = SubSkillType.SWORDS_SERRATED_STRIKES;
|
SERRATED_STRIKES.subSkillTypeDefinition = SubSkillType.SWORDS_SERRATED_STRIKES;
|
||||||
BLAST_MINING.subSkillTypeDefinition = SubSkillType.MINING_BLAST_MINING;
|
BLAST_MINING.subSkillTypeDefinition = SubSkillType.MINING_BLAST_MINING;
|
||||||
TRIDENTS_SUPER_ABILITY.subSkillTypeDefinition = SubSkillType.TRIDENTS_TRIDENTS_SUPER_ABILITY;
|
TRIDENTS_SUPER_ABILITY.subSkillTypeDefinition = SubSkillType.TRIDENTS_SUPER;
|
||||||
SUPER_SHOTGUN.subSkillTypeDefinition = SubSkillType.CROSSBOWS_SUPER_SHOTGUN;
|
SUPER_SHOTGUN.subSkillTypeDefinition = SubSkillType.CROSSBOWS_SUPER_SHOTGUN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,10 +27,7 @@ import com.gmail.nossr50.util.random.ProbabilityUtil;
|
|||||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
||||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.*;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.NamespacedKey;
|
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
@ -48,6 +45,7 @@ import org.bukkit.metadata.FixedMetadataValue;
|
|||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import org.bukkit.projectiles.ProjectileSource;
|
import org.bukkit.projectiles.ProjectileSource;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class EntityListener implements Listener {
|
public class EntityListener implements Listener {
|
||||||
@ -1111,5 +1109,50 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
public void onProjectileHitEvent(ProjectileHitEvent event) {
|
||||||
|
/* WORLD BLACKLIST CHECK */
|
||||||
|
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(event.getEntity() instanceof Arrow originalArrow && event.getHitBlock() != null) {
|
||||||
|
if (originalArrow.getShooter() instanceof Player) {
|
||||||
|
// Avoid infinite spawning of arrows
|
||||||
|
if (originalArrow.hasMetadata(MetadataConstants.METADATA_KEY_SPAWNED_ARROW)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Spawn a new arrow shooting in a random direction
|
||||||
|
spawnArrow(originalArrow, originalArrow.getLocation());
|
||||||
|
spawnArrow(originalArrow, originalArrow.getLocation());
|
||||||
|
spawnArrow(originalArrow, originalArrow.getLocation());
|
||||||
|
spawnArrow(originalArrow, originalArrow.getLocation());
|
||||||
|
spawnArrow(originalArrow, originalArrow.getLocation());
|
||||||
|
spawnArrow(originalArrow, originalArrow.getLocation());
|
||||||
|
spawnArrow(originalArrow, originalArrow.getLocation());
|
||||||
|
spawnArrow(originalArrow, originalArrow.getLocation());
|
||||||
|
spawnArrow(originalArrow, originalArrow.getLocation());
|
||||||
|
spawnArrow(originalArrow, originalArrow.getLocation());
|
||||||
|
spawnArrow(originalArrow, originalArrow.getLocation());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void spawnArrow(Arrow originalArrow, Location origin) {
|
||||||
|
// TODO: Add an event for this for plugins to hook into
|
||||||
|
// Spawn a new arrow shooting in a random direction
|
||||||
|
ProjectileSource originalArrowShooter = originalArrow.getShooter();
|
||||||
|
Arrow arrow = originalArrow.getWorld().spawnArrow(origin,
|
||||||
|
new Vector(
|
||||||
|
// TODO: Spawn arrow away from surface
|
||||||
|
Math.random() * 2 - 1,
|
||||||
|
Math.random() * 2 - 1,
|
||||||
|
Math.random() * 2 - 1), 1, 1);
|
||||||
|
arrow.setShooter(originalArrowShooter);
|
||||||
|
arrow.setMetadata(MetadataConstants.METADATA_KEY_SPAWNED_ARROW,
|
||||||
|
new FixedMetadataValue(pluginRef, originalArrowShooter));
|
||||||
|
arrow.setMetadata(MetadataConstants.METADATA_KEY_BOW_TYPE,
|
||||||
|
new FixedMetadataValue(pluginRef, originalArrow.getMetadata(
|
||||||
|
MetadataConstants.METADATA_KEY_BOW_TYPE).get(0)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
private static CommandManager commandManager; //ACF
|
private static CommandManager commandManager; //ACF
|
||||||
private static TransientEntityTracker transientEntityTracker;
|
private static TransientEntityTracker transientEntityTracker;
|
||||||
|
|
||||||
private @NotNull SkillTools skillTools;
|
private SkillTools skillTools;
|
||||||
|
|
||||||
private static boolean serverShutdownExecuted = false;
|
private static boolean serverShutdownExecuted = false;
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ public class MetadataConstants {
|
|||||||
* Take great care if you ever modify the value of these keys
|
* Take great care if you ever modify the value of these keys
|
||||||
*/
|
*/
|
||||||
public static final @NotNull String METADATA_KEY_REPLANT = "mcMMO: Recently Replanted";
|
public static final @NotNull String METADATA_KEY_REPLANT = "mcMMO: Recently Replanted";
|
||||||
|
public static final @NotNull String METADATA_KEY_SPAWNED_ARROW = "mcMMO: Spawned Arrow";
|
||||||
public static final @NotNull String METADATA_KEY_BOW_TYPE = "mcMMO: Bow Type";
|
public static final @NotNull String METADATA_KEY_BOW_TYPE = "mcMMO: Bow Type";
|
||||||
public static final @NotNull String METADATA_KEY_EXPLOSION_FROM_RUPTURE = "mcMMO: Rupture Explosion";
|
public static final @NotNull String METADATA_KEY_EXPLOSION_FROM_RUPTURE = "mcMMO: Rupture Explosion";
|
||||||
public static final @NotNull String METADATA_KEY_FISH_HOOK_REF = "mcMMO: Fish Hook Tracker";
|
public static final @NotNull String METADATA_KEY_FISH_HOOK_REF = "mcMMO: Fish Hook Tracker";
|
||||||
|
@ -182,6 +182,7 @@ Archery.SubSkill.ArcheryLimitBreak.Description=Breaking your limits. Increased d
|
|||||||
Archery.SubSkill.ArcheryLimitBreak.Stat=Limit Break Max DMG
|
Archery.SubSkill.ArcheryLimitBreak.Stat=Limit Break Max DMG
|
||||||
Archery.Listener=Archery:
|
Archery.Listener=Archery:
|
||||||
Archery.SkillName=ARCHERY
|
Archery.SkillName=ARCHERY
|
||||||
|
Archery.SubSkill.ExplosiveShot.Name=Explosive Shot
|
||||||
Archery.Skills.ExplosiveShot.Off=
|
Archery.Skills.ExplosiveShot.Off=
|
||||||
Archery.Skills.ExplosiveShot.On=&a**EXPLOSIVE SHOT ACTIVATED**
|
Archery.Skills.ExplosiveShot.On=&a**EXPLOSIVE SHOT ACTIVATED**
|
||||||
Archery.Skills.ExplosiveShot.Other.Off=Explosive Shot&a has worn off for &e{0}
|
Archery.Skills.ExplosiveShot.Other.Off=Explosive Shot&a has worn off for &e{0}
|
||||||
|
Loading…
Reference in New Issue
Block a user