Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a134402da | ||
|
|
e6ad4c9268 | ||
|
|
809dcbae85 | ||
|
|
d7fce6834c | ||
|
|
ac807a991b | ||
|
|
ba315ced3c | ||
|
|
f2e65174f9 |
@@ -26,7 +26,7 @@ public class Prerequisite {
|
||||
* Requires the server to be running an implementation of paper.
|
||||
*/
|
||||
public static final Prerequisite HAS_PAPER = new Prerequisite(
|
||||
() -> ClassUtils.exists("com.destroystokyo.paper.event.player.PlayerElytraBoostEvent"),
|
||||
() -> ClassUtils.exists("com.destroystokyo.paper.event.block.BeaconEffectEvent"),
|
||||
"Requires server to be running paper (or a fork)"
|
||||
);
|
||||
|
||||
|
||||
@@ -167,7 +167,10 @@ abstract class HandledCommand implements CommandBase {
|
||||
|
||||
StringUtil.copyPartialMatches(
|
||||
args[0],
|
||||
this.getSubcommands().stream().map(CommandBase::getName).collect(Collectors.toList()),
|
||||
this.getSubcommands().stream()
|
||||
.filter(subCommand -> sender.hasPermission(subCommand.getPermission()))
|
||||
.map(CommandBase::getName)
|
||||
.collect(Collectors.toList()),
|
||||
completions
|
||||
);
|
||||
|
||||
@@ -182,6 +185,10 @@ abstract class HandledCommand implements CommandBase {
|
||||
HandledCommand command = null;
|
||||
|
||||
for (CommandBase subcommand : this.getSubcommands()) {
|
||||
if (!sender.hasPermission(subcommand.getPermission())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase(subcommand.getName())) {
|
||||
command = (HandledCommand) subcommand;
|
||||
}
|
||||
|
||||
@@ -23,26 +23,25 @@ public final class BlockUtils {
|
||||
*/
|
||||
private static final int MAX_BLOCKS = 2500;
|
||||
|
||||
private static Set<Block> getNearbyBlocks(@NotNull final Block origin,
|
||||
private static Set<Block> getNearbyBlocks(@NotNull final Block start,
|
||||
@NotNull final List<Material> allowedMaterials,
|
||||
@NotNull final Set<Block> blocks,
|
||||
final int limit) {
|
||||
for (BlockFace face : BlockFace.values()) {
|
||||
Block block = origin.getRelative(face);
|
||||
|
||||
if (!allowedMaterials.contains(block.getType())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Block block = start.getRelative(face);
|
||||
if (blocks.contains(block)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (blocks.size() >= limit || blocks.size() > MAX_BLOCKS) {
|
||||
return blocks;
|
||||
}
|
||||
if (allowedMaterials.contains(block.getType())) {
|
||||
blocks.add(block);
|
||||
|
||||
blocks.addAll(getNearbyBlocks(block, allowedMaterials, blocks, limit));
|
||||
if (blocks.size() > limit || blocks.size() > MAX_BLOCKS) {
|
||||
return blocks;
|
||||
}
|
||||
|
||||
blocks.addAll(getNearbyBlocks(block, allowedMaterials, blocks, limit));
|
||||
}
|
||||
}
|
||||
|
||||
return blocks;
|
||||
|
||||
@@ -17,7 +17,7 @@ dependencies {
|
||||
|
||||
// Included in spigot jar
|
||||
compileOnly 'com.google.code.gson:gson:2.8.8'
|
||||
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
|
||||
compileOnly 'io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT'
|
||||
|
||||
// Plugin dependencies
|
||||
compileOnly 'com.comphenix.protocol:ProtocolLib:4.6.1-SNAPSHOT'
|
||||
|
||||
@@ -63,7 +63,8 @@ import com.willfp.eco.internal.spigot.display.PacketWindowItems
|
||||
import com.willfp.eco.internal.spigot.display.frame.clearFrames
|
||||
import com.willfp.eco.internal.spigot.drops.CollatedRunnable
|
||||
import com.willfp.eco.internal.spigot.eventlisteners.EntityDeathByEntityListeners
|
||||
import com.willfp.eco.internal.spigot.eventlisteners.NaturalExpGainListeners
|
||||
import com.willfp.eco.internal.spigot.eventlisteners.NaturalExpGainListenersPaper
|
||||
import com.willfp.eco.internal.spigot.eventlisteners.NaturalExpGainListenersSpigot
|
||||
import com.willfp.eco.internal.spigot.eventlisteners.PlayerJumpListenersPaper
|
||||
import com.willfp.eco.internal.spigot.eventlisteners.PlayerJumpListenersSpigot
|
||||
import com.willfp.eco.internal.spigot.eventlisteners.armor.ArmorChangeEventListeners
|
||||
@@ -329,7 +330,6 @@ abstract class EcoSpigotPlugin : EcoPlugin() {
|
||||
|
||||
override fun loadListeners(): List<Listener> {
|
||||
val listeners = mutableListOf(
|
||||
NaturalExpGainListeners(),
|
||||
ArmorListener(),
|
||||
EntityDeathByEntityListeners(this),
|
||||
CraftingRecipeListener(),
|
||||
@@ -343,8 +343,10 @@ abstract class EcoSpigotPlugin : EcoPlugin() {
|
||||
|
||||
if (Prerequisite.HAS_PAPER.isMet) {
|
||||
listeners.add(PlayerJumpListenersPaper())
|
||||
listeners.add(NaturalExpGainListenersPaper())
|
||||
} else {
|
||||
listeners.add(PlayerJumpListenersSpigot())
|
||||
listeners.add(NaturalExpGainListenersSpigot())
|
||||
}
|
||||
|
||||
return listeners
|
||||
|
||||
@@ -1,11 +1,28 @@
|
||||
package com.willfp.eco.internal.spigot.eventlisteners
|
||||
|
||||
import com.willfp.eco.core.events.NaturalExpGainEvent
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.entity.ThrownExpBottle
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.Listener
|
||||
import org.bukkit.event.entity.ExpBottleEvent
|
||||
import org.bukkit.event.player.PlayerExpChangeEvent
|
||||
|
||||
class NaturalExpGainListeners : Listener {
|
||||
class NaturalExpGainListenersPaper : Listener {
|
||||
@EventHandler
|
||||
fun onEvent(event: PlayerExpChangeEvent) {
|
||||
val source = event.source
|
||||
|
||||
if (source is ThrownExpBottle) {
|
||||
return
|
||||
}
|
||||
|
||||
val ecoEvent = NaturalExpGainEvent(event)
|
||||
Bukkit.getPluginManager().callEvent(ecoEvent)
|
||||
}
|
||||
}
|
||||
|
||||
class NaturalExpGainListenersSpigot : Listener {
|
||||
private val events: MutableSet<NaturalExpGainBuilder> = HashSet()
|
||||
|
||||
@EventHandler
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version = 6.35.1
|
||||
version = 6.35.4
|
||||
plugin-name = eco
|
||||
kotlin.code.style = official
|
||||
Reference in New Issue
Block a user