Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb1febab85 | ||
|
|
8153ba55ab | ||
|
|
89784f3412 | ||
|
|
49e82385d4 | ||
|
|
190034f5aa | ||
|
|
1db744c4ec | ||
|
|
94d7baf791 | ||
|
|
c25af3f6d3 | ||
|
|
3b38c82b47 | ||
|
|
526f831fcb | ||
|
|
e4151cbbe0 | ||
|
|
47d9fed823 | ||
|
|
0890b2abbd | ||
|
|
be99a8646d | ||
|
|
b58266c868 | ||
|
|
eaa02a4166 | ||
|
|
08e99ded13 | ||
|
|
e867e7e697 |
No files matched your search
@@ -16,14 +16,14 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
- name: Cache Gradle
|
||||
uses: actions/cache@v3.3.1
|
||||
uses: actions/cache@v3.3.2
|
||||
with:
|
||||
path: ~/.gradle/caches
|
||||
key: >-
|
||||
@@ -33,11 +33,11 @@ jobs:
|
||||
- name: Make gradlew executable
|
||||
run: chmod +x gradlew
|
||||
- name: Build with Gradle
|
||||
uses: gradle/gradle-build-action@e3426b1f20c7262e0fed7b855aae1325633af3b4
|
||||
uses: gradle/gradle-build-action@982da8e78c05368c70dac0351bb82647a9e9a5d2
|
||||
with:
|
||||
arguments: shadowJar
|
||||
- name: Upload a Build Artifact
|
||||
uses: actions/upload-artifact@v3.1.2
|
||||
uses: actions/upload-artifact@v4.0.0
|
||||
with:
|
||||
name: 'Successfully build EternalCombat'
|
||||
path: build/libs/*.jar
|
||||
path: eternalcombat-plugin/build/libs/*.jar
|
||||
@@ -12,7 +12,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 17
|
||||
|
||||
@@ -35,6 +35,43 @@ Build EternalCombat using:
|
||||
- `eternalcombat.receiveupdates` - Allows you to receive notifications about the new version of the plugin when
|
||||
attaching
|
||||
|
||||
### Developer API
|
||||
|
||||
#### 1. Add repository:
|
||||
|
||||
with Gradle:
|
||||
```kts
|
||||
maven {
|
||||
url = uri("https://repo.eternalcode.pl/releases")
|
||||
}
|
||||
```
|
||||
|
||||
with Maven:
|
||||
```xml
|
||||
<repository>
|
||||
<id>eternalcode-reposilite-releases</id>
|
||||
<name>EternalCode Repository</name>
|
||||
<url>https://repo.eternalcode.pl/releases</url>
|
||||
</repository>
|
||||
```
|
||||
|
||||
#### 2. Add dependency:
|
||||
|
||||
with Gradle:
|
||||
```kts
|
||||
compileOnly("com.eternalcode:eternalcombat-api:1.1.1")
|
||||
```
|
||||
|
||||
with Maven:
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>com.eternalcode</groupId>
|
||||
<artifactId>eternalcombat-api</artifactId>
|
||||
<version>1.1.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
### Contributing
|
||||
|
||||
We welcome all contributions to the EternalCombat project! Please check out [contributing](.github/CONTRIBUTING.md) for
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.22")
|
||||
implementation("com.github.johnrengelman:shadow:8.1.1")
|
||||
implementation("net.minecrell:plugin-yml:0.6.0")
|
||||
implementation("xyz.jpenilla:run-task:2.2.2")
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
plugins {
|
||||
`java-library`
|
||||
checkstyle
|
||||
}
|
||||
|
||||
group = "com.eternalcode"
|
||||
version = "1.1.1"
|
||||
|
||||
checkstyle {
|
||||
toolVersion = "10.12.5"
|
||||
|
||||
configFile = file("${rootDir}/config/checkstyle/checkstyle.xml")
|
||||
|
||||
maxErrors = 0
|
||||
maxWarnings = 0
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
maven { url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") }
|
||||
maven { url = uri("https://papermc.io/repo/repository/maven-public/") }
|
||||
maven { url = uri("https://repo.eternalcode.pl/releases") }
|
||||
maven { url = uri("https://storehouse.okaeri.eu/repository/maven-public/") }
|
||||
maven { url = uri("https://repo.panda-lang.org/releases") }
|
||||
maven { url = uri("https://maven.enginehub.org/repo/") }
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
tasks.compileJava {
|
||||
options.compilerArgs = listOf("-Xlint:deprecation", "-parameters")
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
@@ -1,69 +1,48 @@
|
||||
plugins {
|
||||
`java-library`
|
||||
checkstyle
|
||||
id("eternalcombat.java")
|
||||
|
||||
id("maven-publish")
|
||||
}
|
||||
|
||||
group = "com.eternalcode"
|
||||
version = "1.1.1"
|
||||
|
||||
checkstyle {
|
||||
toolVersion = "10.12.2"
|
||||
|
||||
configFile = file("${rootDir}/config/checkstyle/checkstyle.xml")
|
||||
|
||||
maxErrors = 0
|
||||
maxWarnings = 0
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
maven { url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") }
|
||||
maven { url = uri("https://papermc.io/repo/repository/maven-public/") }
|
||||
maven { url = uri("https://repo.eternalcode.pl/releases") }
|
||||
maven { url = uri("https://storehouse.okaeri.eu/repository/maven-public/") }
|
||||
maven { url = uri("https://repo.panda-lang.org/releases") }
|
||||
maven { url = uri("https://maven.enginehub.org/repo/") }
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Spigot api
|
||||
compileOnlyApi("org.spigotmc:spigot-api:1.19.3-R0.1-SNAPSHOT")
|
||||
compileOnlyApi(libs.spigotApi)
|
||||
|
||||
// kyori
|
||||
api("net.kyori:adventure-platform-bukkit:4.3.0")
|
||||
api("net.kyori:adventure-text-minimessage:4.14.0")
|
||||
api(libs.adventurePlatformBukkit)
|
||||
api(libs.adventureTextMinimessage)
|
||||
|
||||
// litecommands
|
||||
api("dev.rollczi.litecommands:bukkit-adventure:2.8.9")
|
||||
api(libs.liteCommands)
|
||||
|
||||
// Okaeri configs
|
||||
api("eu.okaeri:okaeri-configs-yaml-bukkit:5.0.0-beta.5")
|
||||
api("eu.okaeri:okaeri-configs-serdes-commons:5.0.0-beta.5")
|
||||
api("eu.okaeri:okaeri-configs-serdes-bukkit:5.0.0-beta.5")
|
||||
api(libs.okaeriConfigsYamlBukkit)
|
||||
api(libs.okaeriConfigsSerdesCommons)
|
||||
api(libs.okaeriConfigsSerdesBukkit)
|
||||
|
||||
// Panda utilities
|
||||
api("org.panda-lang:panda-utilities:0.5.2-alpha")
|
||||
api(libs.pandaUtilities)
|
||||
|
||||
// GitCheck
|
||||
api("com.eternalcode:gitcheck:1.0.0")
|
||||
api(libs.gitCheck)
|
||||
|
||||
// commons
|
||||
api("commons-io:commons-io:2.13.0")
|
||||
api(libs.apacheCommons)
|
||||
|
||||
// bstats
|
||||
api("org.bstats:bstats-bukkit:3.0.2")
|
||||
api(libs.bStatsBukkit)
|
||||
|
||||
// caffeine
|
||||
api(libs.caffeine)
|
||||
|
||||
// worldguard
|
||||
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.9")
|
||||
compileOnly(libs.worldGuardBukkit)
|
||||
|
||||
// tests
|
||||
testImplementation("org.spigotmc:spigot-api:1.19.3-R0.1-SNAPSHOT")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.0")
|
||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.0")
|
||||
testImplementation(libs.spigotApi)
|
||||
testImplementation(libs.jUnitJupiterApi)
|
||||
testImplementation(libs.jUnitJupiterParams)
|
||||
testRuntimeOnly(libs.jUnitJupiterEngine)
|
||||
}
|
||||
|
||||
java {
|
||||
@@ -75,8 +54,6 @@ tasks.getByName<Test>("test") {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
// Publish
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
@@ -89,16 +66,12 @@ publishing {
|
||||
from(project.components["java"])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
||||
maven {
|
||||
name = "eternalcodeReleases"
|
||||
url = uri("https://repo.eternalcode.pl/releases")
|
||||
|
||||
credentials {
|
||||
username = System.getenv("ETERNAL_CODE_MAVEN_USERNAME")
|
||||
password = System.getenv("ETERNAL_CODE_MAVEN_PASSWORD")
|
||||
@@ -106,4 +79,3 @@ publishing {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -55,6 +55,9 @@ public class PluginConfig extends OkaeriConfig {
|
||||
@Comment("# Release attacker after victim dies?")
|
||||
public boolean shouldReleaseAttacker = true;
|
||||
|
||||
@Comment("# If you want to exclude admins from combat, set this to true")
|
||||
public boolean excludeAdminFromCombat = true;
|
||||
|
||||
@Comment("# Command blocking mode, available modes: WHITELIST, BLACKLIST")
|
||||
public WhitelistBlacklistMode commandBlockingMode = WhitelistBlacklistMode.BLACKLIST;
|
||||
|
||||
@@ -72,6 +75,9 @@ public class PluginConfig extends OkaeriConfig {
|
||||
@Comment("# Block the use of elytra?")
|
||||
public boolean shouldPreventElytraUsage = true;
|
||||
|
||||
@Comment("# Block flying? (flying players will fall to the ground)")
|
||||
public boolean shouldPreventFlying = true;
|
||||
|
||||
@Comment("# Disable the use of elytra on damage?")
|
||||
public boolean shouldElytraDisableOnDamage = true;
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.eternalcode.combat.drop;
|
||||
|
||||
import com.eternalcode.combat.fight.FightDeathCause;
|
||||
import com.eternalcode.combat.fight.FightTag;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -15,18 +13,13 @@ public class Drop {
|
||||
|
||||
private final Player player;
|
||||
private final Player killer;
|
||||
private final FightTag fightTag;
|
||||
private final FightDeathCause deathCause;
|
||||
|
||||
private final List<ItemStack> droppedItems;
|
||||
private final int droppedExp;
|
||||
|
||||
private Drop(Player player, Player killer, FightTag fightTag, FightDeathCause deathCause, List<ItemStack> droppedItems, int droppedExp) {
|
||||
private Drop(Player player, Player killer, List<ItemStack> droppedItems, int droppedExp) {
|
||||
this.player = player;
|
||||
this.killer = killer;
|
||||
this.fightTag = fightTag;
|
||||
this.deathCause = deathCause;
|
||||
|
||||
this.droppedItems = droppedItems;
|
||||
this.droppedExp = droppedExp;
|
||||
}
|
||||
@@ -43,14 +36,6 @@ public class Drop {
|
||||
return this.killer;
|
||||
}
|
||||
|
||||
public FightTag getFightTag() {
|
||||
return this.fightTag;
|
||||
}
|
||||
|
||||
public FightDeathCause getDeathCause() {
|
||||
return this.deathCause;
|
||||
}
|
||||
|
||||
public boolean hasKiller() {
|
||||
return this.killer != null;
|
||||
}
|
||||
@@ -67,8 +52,6 @@ public class Drop {
|
||||
|
||||
private Player player;
|
||||
private Player killer;
|
||||
private FightTag fightTag;
|
||||
private FightDeathCause deathCause;
|
||||
private List<ItemStack> droppedItems;
|
||||
private int droppedExp;
|
||||
|
||||
@@ -82,16 +65,6 @@ public class Drop {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder fightTag(@NotNull FightTag fightTag) {
|
||||
this.fightTag = fightTag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder deathCause(@NotNull FightDeathCause deathCause) {
|
||||
this.deathCause = deathCause;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder droppedItems(@NotNull List<ItemStack> droppedItems) {
|
||||
this.droppedItems = new ArrayList<>(droppedItems);
|
||||
return this;
|
||||
@@ -106,8 +79,6 @@ public class Drop {
|
||||
return new Drop(
|
||||
this.player,
|
||||
this.killer,
|
||||
this.fightTag,
|
||||
this.deathCause,
|
||||
this.droppedItems,
|
||||
this.droppedExp
|
||||
);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.eternalcode.combat.drop;
|
||||
|
||||
import com.eternalcode.combat.fight.FightManager;
|
||||
import com.eternalcode.combat.fight.FightTag;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
@@ -27,7 +27,7 @@ public class DropController implements Listener {
|
||||
this.fightManager = fightManager;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
void onPlayerDeath(PlayerDeathEvent event) {
|
||||
Player player = event.getEntity();
|
||||
|
||||
@@ -36,22 +36,21 @@ public class DropController implements Listener {
|
||||
if (dropType == DropType.UNCHANGED || !this.fightManager.isInCombat(player.getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
FightTag fightTag = this.fightManager.getTag(player.getUniqueId());
|
||||
|
||||
List<ItemStack> drops = event.getDrops();
|
||||
|
||||
Drop drop = Drop.builder()
|
||||
.player(player)
|
||||
.killer(player.getKiller())
|
||||
.fightTag(fightTag)
|
||||
.deathCause(fightTag.getDeathCause())
|
||||
.droppedItems(drops)
|
||||
.droppedExp(player.getTotalExperience())
|
||||
.build();
|
||||
|
||||
DropResult result = this.dropManager.modify(dropType, drop);
|
||||
|
||||
if (result == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
drops.clear();
|
||||
drops.addAll(result.droppedItems());
|
||||
|
||||
|
||||
+12
-6
@@ -5,8 +5,8 @@ import com.eternalcode.combat.drop.DropModifier;
|
||||
import com.eternalcode.combat.drop.DropResult;
|
||||
import com.eternalcode.combat.drop.DropSettings;
|
||||
import com.eternalcode.combat.drop.DropType;
|
||||
import com.eternalcode.combat.fight.FightDeathCause;
|
||||
import com.eternalcode.combat.fight.FightTag;
|
||||
import com.eternalcode.combat.fight.logout.Logout;
|
||||
import com.eternalcode.combat.fight.logout.LogoutService;
|
||||
import com.eternalcode.combat.util.InventoryUtil;
|
||||
import com.eternalcode.combat.util.MathUtil;
|
||||
import com.eternalcode.combat.util.RemoveItemResult;
|
||||
@@ -15,13 +15,16 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class PlayersHealthDropModifier implements DropModifier {
|
||||
|
||||
private final DropSettings settings;
|
||||
private final LogoutService logoutService;
|
||||
|
||||
public PlayersHealthDropModifier(DropSettings settings) {
|
||||
public PlayersHealthDropModifier(DropSettings settings, LogoutService logoutService) {
|
||||
this.settings = settings;
|
||||
this.logoutService = logoutService;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -31,17 +34,20 @@ public class PlayersHealthDropModifier implements DropModifier {
|
||||
|
||||
@Override
|
||||
public DropResult modifyDrop(Drop drop) {
|
||||
if (drop.getDeathCause() != FightDeathCause.ESCAPE) {
|
||||
Optional<Logout> logoutOptional = logoutService.nextLogoutFor(drop.getPlayer().getUniqueId());
|
||||
|
||||
if (logoutOptional.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Logout logout = logoutOptional.get();
|
||||
Player player = drop.getPlayer();
|
||||
FightTag fightTag = drop.getFightTag();
|
||||
|
||||
List<ItemStack> droppedItems = drop.getDroppedItems();
|
||||
|
||||
double maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
|
||||
double health = fightTag.getHealthBeforeDeath();
|
||||
double health = logout.health();
|
||||
|
||||
int percentHealth = MathUtil.getRoundedCountPercentage(health, maxHealth);
|
||||
int reversedPercent = MathUtil.clamp(100 - percentHealth, this.settings.playersHealthPercentClamp, 100);
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.eternalcode.combat.fight;
|
||||
|
||||
public enum FightDeathCause {
|
||||
|
||||
UNKNOWN,
|
||||
ESCAPE,
|
||||
KILLED_BY_PLAYER,
|
||||
KILLED_BY_ENTITY
|
||||
|
||||
}
|
||||
@@ -9,15 +9,10 @@ public class FightTag {
|
||||
private final UUID taggedPlayer;
|
||||
private final Instant endOfCombatLog;
|
||||
|
||||
private double healthBeforeDeath;
|
||||
private FightDeathCause deathCause;
|
||||
|
||||
FightTag(UUID personToAddCombat, Instant endOfCombatLog) {
|
||||
this.taggedPlayer = personToAddCombat;
|
||||
this.endOfCombatLog = endOfCombatLog;
|
||||
|
||||
this.healthBeforeDeath = 0;
|
||||
this.deathCause = FightDeathCause.UNKNOWN;
|
||||
}
|
||||
|
||||
public UUID getTaggedPlayer() {
|
||||
@@ -42,19 +37,4 @@ public class FightTag {
|
||||
return between;
|
||||
}
|
||||
|
||||
public double getHealthBeforeDeath() {
|
||||
return this.healthBeforeDeath;
|
||||
}
|
||||
|
||||
public void setHealthBeforeDeath(double health) {
|
||||
this.healthBeforeDeath = health;
|
||||
}
|
||||
|
||||
public FightDeathCause getDeathCause() {
|
||||
return this.deathCause;
|
||||
}
|
||||
|
||||
public void setDeathCause(FightDeathCause deathCause) {
|
||||
this.deathCause = deathCause;
|
||||
}
|
||||
}
|
||||
+24
-3
@@ -14,6 +14,7 @@ import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityToggleGlideEvent;
|
||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@@ -63,7 +64,7 @@ public class FightActionBlockerController implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onToggleGlide(EntityToggleGlideEvent event) {
|
||||
void onToggleGlide(EntityToggleGlideEvent event) {
|
||||
if (!this.config.settings.shouldPreventElytraUsage) {
|
||||
return;
|
||||
}
|
||||
@@ -83,7 +84,27 @@ public class FightActionBlockerController implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDamage(EntityDamageEvent event) {
|
||||
void onFly(PlayerToggleFlightEvent event) {
|
||||
if (!this.config.settings.shouldPreventFlying) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
UUID uniqueId = player.getUniqueId();
|
||||
|
||||
if (!this.fightManager.isInCombat(uniqueId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.isFlying()) {
|
||||
player.setAllowFlight(false);
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
void onDamage(EntityDamageEvent event) {
|
||||
if (!this.config.settings.shouldElytraDisableOnDamage) {
|
||||
return;
|
||||
}
|
||||
@@ -117,7 +138,7 @@ public class FightActionBlockerController implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
UUID playerUniqueId = player.getUniqueId();
|
||||
|
||||
|
||||
-59
@@ -1,59 +0,0 @@
|
||||
package com.eternalcode.combat.fight.controller;
|
||||
|
||||
import com.eternalcode.combat.fight.FightDeathCause;
|
||||
import com.eternalcode.combat.fight.FightManager;
|
||||
import com.eternalcode.combat.fight.FightTag;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
public class FightDeathCauseController implements Listener {
|
||||
|
||||
private final FightManager fightManager;
|
||||
|
||||
public FightDeathCauseController(FightManager fightManager) {
|
||||
this.fightManager = fightManager;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event) {
|
||||
Entity victimEntity = event.getEntity();
|
||||
Entity damagerEntity = event.getDamager();
|
||||
|
||||
if (!(victimEntity instanceof Player victim)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.fightManager.isInCombat(victim.getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (victim.getHealth() > event.getFinalDamage()) {
|
||||
return;
|
||||
}
|
||||
|
||||
FightTag fightTag = this.fightManager.getTag(damagerEntity.getUniqueId());
|
||||
|
||||
if (damagerEntity instanceof Player) {
|
||||
fightTag.setDeathCause(FightDeathCause.KILLED_BY_PLAYER);
|
||||
return;
|
||||
}
|
||||
|
||||
fightTag.setDeathCause(FightDeathCause.KILLED_BY_ENTITY);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onQuit(PlayerQuitEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!this.fightManager.isInCombat(player.getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
FightTag fightTag = this.fightManager.getTag(player.getUniqueId());
|
||||
fightTag.setDeathCause(FightDeathCause.ESCAPE);
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -3,13 +3,16 @@ package com.eternalcode.combat.fight.controller;
|
||||
import com.eternalcode.combat.config.implementation.PluginConfig;
|
||||
import com.eternalcode.combat.fight.FightManager;
|
||||
import com.eternalcode.combat.fight.bossbar.FightBossBarService;
|
||||
import com.eternalcode.combat.fight.event.CauseOfUnTag;
|
||||
import com.eternalcode.combat.fight.event.FightTagEvent;
|
||||
import com.eternalcode.combat.fight.event.FightUntagEvent;
|
||||
import com.eternalcode.combat.notification.NotificationAnnouncer;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import panda.utilities.text.Formatter;
|
||||
|
||||
public class FightMessageController implements Listener {
|
||||
|
||||
@@ -43,7 +46,7 @@ public class FightMessageController implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
void onUnTag(FightTagEvent event) {
|
||||
void onUnTag(FightUntagEvent event) {
|
||||
Player player = this.server.getPlayer(event.getPlayer());
|
||||
|
||||
if (player == null) {
|
||||
@@ -57,5 +60,4 @@ public class FightMessageController implements Listener {
|
||||
this.announcer.sendMessage(player, this.config.messages.playerUntagged);
|
||||
this.bossBarService.hide(event.getPlayer());
|
||||
}
|
||||
|
||||
}
|
||||
+27
-11
@@ -1,10 +1,9 @@
|
||||
package com.eternalcode.combat.fight.controller;
|
||||
|
||||
import com.eternalcode.combat.WhitelistBlacklistMode;
|
||||
import com.eternalcode.combat.fight.event.CauseOfTag;
|
||||
import com.eternalcode.combat.config.implementation.PluginConfig;
|
||||
import com.eternalcode.combat.fight.FightManager;
|
||||
import com.eternalcode.combat.notification.NotificationAnnouncer;
|
||||
import com.eternalcode.combat.fight.event.CauseOfTag;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
@@ -23,12 +22,10 @@ public class FightTagController implements Listener {
|
||||
|
||||
private final FightManager fightManager;
|
||||
private final PluginConfig config;
|
||||
private final NotificationAnnouncer announcer;
|
||||
|
||||
public FightTagController(FightManager fightManager, PluginConfig config, NotificationAnnouncer announcer) {
|
||||
public FightTagController(FightManager fightManager, PluginConfig config) {
|
||||
this.fightManager = fightManager;
|
||||
this.config = config;
|
||||
this.announcer = announcer;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@@ -38,7 +35,7 @@ public class FightTagController implements Listener {
|
||||
}
|
||||
|
||||
List<EntityType> disabledProjectileEntities = this.config.settings.disabledProjectileEntities;
|
||||
|
||||
|
||||
if (event.getDamager() instanceof Projectile projectile && disabledProjectileEntities.contains(projectile.getType())) {
|
||||
return;
|
||||
}
|
||||
@@ -47,19 +44,38 @@ public class FightTagController implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
Player personToAddCombatTime = this.getDamager(event);
|
||||
Player attacker = this.getDamager(event);
|
||||
|
||||
if (personToAddCombatTime == null) {
|
||||
if (attacker == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Duration combatTime = this.config.settings.combatDuration;
|
||||
|
||||
UUID attackedUniqueId = attackedPlayerByPerson.getUniqueId();
|
||||
UUID personToAddCombatTimeUniqueId = personToAddCombatTime.getUniqueId();
|
||||
UUID attackerUniqueId = attacker.getUniqueId();
|
||||
|
||||
if (attacker.isOp()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (attackedPlayerByPerson.isOp() && this.config.settings.excludeAdminFromCombat) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.config.settings.shouldPreventFlying) {
|
||||
if (attackedPlayerByPerson.isFlying()) {
|
||||
attackedPlayerByPerson.setFlying(false);
|
||||
attackedPlayerByPerson.setAllowFlight(false);
|
||||
}
|
||||
|
||||
if (attacker.isFlying()) {
|
||||
attacker.setFlying(false);
|
||||
attacker.setAllowFlight(false);
|
||||
}
|
||||
}
|
||||
|
||||
this.fightManager.tag(attackedUniqueId, combatTime, CauseOfTag.PLAYER);
|
||||
this.fightManager.tag(personToAddCombatTimeUniqueId, combatTime, CauseOfTag.PLAYER);
|
||||
this.fightManager.tag(attackerUniqueId, combatTime, CauseOfTag.PLAYER);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
|
||||
+23
-3
@@ -3,6 +3,7 @@ package com.eternalcode.combat.fight.controller;
|
||||
import com.eternalcode.combat.fight.event.CauseOfUnTag;
|
||||
import com.eternalcode.combat.config.implementation.PluginConfig;
|
||||
import com.eternalcode.combat.fight.FightManager;
|
||||
import com.eternalcode.combat.fight.logout.LogoutService;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -12,10 +13,12 @@ public class FightUnTagController implements Listener {
|
||||
|
||||
private final FightManager fightManager;
|
||||
private final PluginConfig config;
|
||||
private final LogoutService logoutService;
|
||||
|
||||
public FightUnTagController(FightManager fightManager, PluginConfig config) {
|
||||
public FightUnTagController(FightManager fightManager, PluginConfig config, LogoutService logoutService) {
|
||||
this.fightManager = fightManager;
|
||||
this.config = config;
|
||||
this.logoutService = logoutService;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -27,12 +30,29 @@ public class FightUnTagController implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
CauseOfUnTag causeOfUnTag = (killer == null ? CauseOfUnTag.DEATH_BY_PLAYER : CauseOfUnTag.DEATH);
|
||||
CauseOfUnTag cause = this.getDeathCause(player, killer);
|
||||
|
||||
this.fightManager.untag(player.getUniqueId(), causeOfUnTag);
|
||||
this.fightManager.untag(player.getUniqueId(), cause);
|
||||
|
||||
if (killer != null && this.config.settings.shouldReleaseAttacker) {
|
||||
this.fightManager.untag(killer.getUniqueId(), CauseOfUnTag.ATTACKER_RELEASE);
|
||||
}
|
||||
}
|
||||
|
||||
private CauseOfUnTag getDeathCause(Player player, Player killer) {
|
||||
if (logoutService.hasLoggedOut(player.getUniqueId())) {
|
||||
return CauseOfUnTag.LOGOUT;
|
||||
}
|
||||
|
||||
if (killer == null) {
|
||||
return CauseOfUnTag.DEATH;
|
||||
}
|
||||
|
||||
if (this.fightManager.isInCombat(killer.getUniqueId())) {
|
||||
return CauseOfUnTag.DEATH_BY_PLAYER;
|
||||
}
|
||||
|
||||
return CauseOfUnTag.DEATH;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -10,7 +10,7 @@ import java.util.Map;
|
||||
public class FightEffectSettings extends OkaeriConfig {
|
||||
|
||||
@Comment({"# Do you want to add effects to players in combat?"})
|
||||
public boolean customEffectsEnabled = true;
|
||||
public boolean customEffectsEnabled = false;
|
||||
|
||||
@Comment({
|
||||
"# If the option above is set to true, you can add effects to players in combat below",
|
||||
|
||||
@@ -3,5 +3,6 @@ package com.eternalcode.combat.fight.event;
|
||||
public enum CauseOfTag {
|
||||
PLAYER,
|
||||
NON_PLAYER,
|
||||
COMMAND
|
||||
COMMAND,
|
||||
CUSTOM
|
||||
}
|
||||
+2
-1
@@ -6,5 +6,6 @@ public enum CauseOfUnTag {
|
||||
DEATH_BY_PLAYER,
|
||||
LOGOUT,
|
||||
COMMAND,
|
||||
ATTACKER_RELEASE
|
||||
ATTACKER_RELEASE,
|
||||
CUSTOM
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.eternalcode.combat.fight.logout;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public record Logout(UUID player, double health) {
|
||||
}
|
||||
+16
-14
@@ -1,45 +1,47 @@
|
||||
package com.eternalcode.combat.fight.controller;
|
||||
package com.eternalcode.combat.fight.logout;
|
||||
|
||||
import com.eternalcode.combat.config.implementation.PluginConfig;
|
||||
import com.eternalcode.combat.fight.FightManager;
|
||||
import com.eternalcode.combat.fight.FightTag;
|
||||
import com.eternalcode.combat.notification.NotificationAnnouncer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import panda.utilities.text.Formatter;
|
||||
|
||||
public class FightEscapeController implements Listener {
|
||||
public class LogoutController implements Listener {
|
||||
|
||||
private final FightManager fightManager;
|
||||
private final PluginConfig config;
|
||||
private final LogoutService logoutService;
|
||||
private final NotificationAnnouncer announcer;
|
||||
private final PluginConfig config;
|
||||
|
||||
public FightEscapeController(FightManager fightManager, PluginConfig config, NotificationAnnouncer announcer) {
|
||||
|
||||
public LogoutController(FightManager fightManager, LogoutService logoutService, NotificationAnnouncer announcer, PluginConfig config) {
|
||||
this.fightManager = fightManager;
|
||||
this.config = config;
|
||||
this.logoutService = logoutService;
|
||||
this.announcer = announcer;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
void onPlayerQuit(PlayerQuitEvent event) {
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
void onQuit(PlayerQuitEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!this.fightManager.isInCombat(player.getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
logoutService.punishForLogout(player);
|
||||
player.setHealth(0.0);
|
||||
|
||||
Formatter formatter = new Formatter()
|
||||
.register("{PLAYER}", player.getName());
|
||||
.register("{PLAYER}", player.getName());
|
||||
|
||||
String format = formatter.format(this.config.messages.playerLoggedOutDuringCombat);
|
||||
|
||||
this.announcer.broadcast(format);
|
||||
|
||||
FightTag fightTag = this.fightManager.getTag(player.getUniqueId());
|
||||
fightTag.setHealthBeforeDeath(player.getHealth());
|
||||
|
||||
player.setHealth(0.0); // Untagged in PlayerDeathEvent
|
||||
}
|
||||
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.eternalcode.combat.fight.logout;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class LogoutService {
|
||||
|
||||
private final Cache<UUID, Logout> logouts = CacheBuilder.newBuilder()
|
||||
.expireAfterWrite(1, TimeUnit.MINUTES)
|
||||
.build();
|
||||
|
||||
public void punishForLogout(Player player) {
|
||||
UUID uniqueId = player.getUniqueId();
|
||||
|
||||
this.logouts.put(uniqueId, new Logout(uniqueId, player.getHealth()));
|
||||
}
|
||||
|
||||
public Optional<Logout> nextLogoutFor(UUID player) {
|
||||
Logout logout = this.logouts.getIfPresent(player);
|
||||
|
||||
if (logout == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
this.logouts.invalidate(player);
|
||||
return Optional.of(logout);
|
||||
}
|
||||
|
||||
public boolean hasLoggedOut(UUID player) {
|
||||
return this.logouts.asMap().containsKey(player);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.eternalcode.combat.fight.pearl;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.github.benmanes.caffeine.cache.Cache;
|
||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
@@ -14,7 +14,7 @@ public class FightPearlManager {
|
||||
|
||||
public FightPearlManager(FightPearlSettings pearlSettings) {
|
||||
this.pearlSettings = pearlSettings;
|
||||
this.pearlDelays = CacheBuilder.newBuilder()
|
||||
this.pearlDelays = Caffeine.newBuilder()
|
||||
.expireAfterWrite(pearlSettings.pearlThrowDelay)
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class RegionController implements Listener {
|
||||
@@ -57,4 +58,20 @@ public class RegionController implements Listener {
|
||||
this.announcer.sendMessage(player, this.pluginConfig.messages.cantEnterOnRegion);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!this.fightManager.isInCombat(player.getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
Location targetLocation = event.getTo();
|
||||
|
||||
if (this.regionProvider.isInRegion(targetLocation)) {
|
||||
event.setCancelled(true);
|
||||
this.announcer.sendMessage(player, this.pluginConfig.messages.cantEnterOnRegion);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.function.ToIntFunction;
|
||||
|
||||
@@ -23,49 +21,31 @@ public class InventoryUtil {
|
||||
}
|
||||
|
||||
public static RemoveItemResult removeRandomItems(List<ItemStack> list, int itemsToDelete) {
|
||||
List<ItemStack> restItems = new ArrayList<>(list);
|
||||
Map<Integer, ItemStack> removedItems = new HashMap<>();
|
||||
List<ItemStack> currentItems = new ArrayList<>(list);
|
||||
List<ItemStack> removedItems = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < itemsToDelete; i++) {
|
||||
if (restItems.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
int currentItemsToDelete = itemsToDelete;
|
||||
while (currentItemsToDelete > 0) {
|
||||
int randomIndex = RANDOM.nextInt(list.size());
|
||||
ItemStack currentItem = currentItems.get(randomIndex);
|
||||
|
||||
int randomIndex = RANDOM.nextInt(restItems.size());
|
||||
int amount = currentItem.getAmount();
|
||||
int randomAmount = RANDOM.nextInt(0, Math.min(currentItemsToDelete, amount) + 1);
|
||||
|
||||
ItemStack item = restItems.get(randomIndex);
|
||||
int newAmount = item.getAmount() - 1;
|
||||
|
||||
if (newAmount <= 0) {
|
||||
restItems.remove(randomIndex);
|
||||
incrementItem(removedItems, randomIndex, item);
|
||||
if (amount <= 0 || randomAmount <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
item.setAmount(newAmount);
|
||||
incrementItem(removedItems, randomIndex, item);
|
||||
ItemStack removedItem = currentItem.clone();
|
||||
removedItem.setAmount(randomAmount);
|
||||
removedItems.add(removedItem);
|
||||
|
||||
currentItem.setAmount(amount - randomAmount);
|
||||
|
||||
currentItemsToDelete -= randomAmount;
|
||||
}
|
||||
|
||||
return new RemoveItemResult(restItems, new ArrayList<>(removedItems.values()));
|
||||
}
|
||||
|
||||
// TODO: kinda shitty, but no time for a proper solution now
|
||||
private static void incrementItem(Map<Integer, ItemStack> items, int index, ItemStack itemStack) {
|
||||
ItemStack itemInList = items.get(index);
|
||||
|
||||
if (itemInList == null) {
|
||||
ItemStack cloned = itemStack.clone();
|
||||
|
||||
cloned.setAmount(1);
|
||||
items.put(index, cloned);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!itemInList.isSimilar(itemStack)) {
|
||||
throw new IllegalStateException("Items are not similar!");
|
||||
}
|
||||
|
||||
itemInList.setAmount(itemInList.getAmount() + 1);
|
||||
return new RemoveItemResult(currentItems, removedItems);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +1,9 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
checkstyle
|
||||
id("eternalcombat.java")
|
||||
|
||||
id("net.minecrell.plugin-yml.bukkit") version "0.6.0"
|
||||
id("com.github.johnrengelman.shadow") version "8.1.1"
|
||||
id("xyz.jpenilla.run-paper") version "2.1.0"
|
||||
}
|
||||
|
||||
checkstyle {
|
||||
toolVersion = "10.12.2"
|
||||
|
||||
configFile = file("${rootDir}/config/checkstyle/checkstyle.xml")
|
||||
|
||||
maxErrors = 0
|
||||
maxWarnings = 0
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
maven { url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") }
|
||||
maven { url = uri("https://papermc.io/repo/repository/maven-public/") }
|
||||
maven { url = uri("https://repo.eternalcode.pl/releases") }
|
||||
maven { url = uri("https://storehouse.okaeri.eu/repository/maven-public/") }
|
||||
maven { url = uri("https://repo.panda-lang.org/releases") }
|
||||
maven { url = uri("https://maven.enginehub.org/repo/") }
|
||||
id("net.minecrell.plugin-yml.bukkit")
|
||||
id("com.github.johnrengelman.shadow")
|
||||
id("xyz.jpenilla.run-paper")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -43,23 +20,13 @@ bukkit {
|
||||
version = "${project.version}"
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
options.compilerArgs = listOf("-Xlint:deprecation", "-parameters")
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
tasks {
|
||||
runServer {
|
||||
minecraftVersion("1.19.4")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<ShadowJar> {
|
||||
tasks.shadowJar {
|
||||
archiveFileName.set("EternalCombat v${project.version}.jar")
|
||||
|
||||
dependsOn("checkstyleMain")
|
||||
@@ -86,7 +53,8 @@ tasks.withType<ShadowJar> {
|
||||
"com.eternalcode.gitcheck",
|
||||
"org.json.simple",
|
||||
"org.apache.commons",
|
||||
"javassist"
|
||||
"javassist",
|
||||
"com.github.benmanes.caffeine",
|
||||
).forEach { pack ->
|
||||
relocate(pack, "$prefix.$pack")
|
||||
}
|
||||
|
||||
@@ -12,8 +12,6 @@ import com.eternalcode.combat.drop.DropManager;
|
||||
import com.eternalcode.combat.drop.impl.PercentDropModifier;
|
||||
import com.eternalcode.combat.drop.impl.PlayersHealthDropModifier;
|
||||
import com.eternalcode.combat.fight.controller.FightActionBlockerController;
|
||||
import com.eternalcode.combat.fight.controller.FightDeathCauseController;
|
||||
import com.eternalcode.combat.fight.controller.FightEscapeController;
|
||||
import com.eternalcode.combat.fight.controller.FightMessageController;
|
||||
import com.eternalcode.combat.fight.controller.FightTagController;
|
||||
import com.eternalcode.combat.fight.controller.FightUnTagController;
|
||||
@@ -23,6 +21,8 @@ import com.eternalcode.combat.fight.FightManager;
|
||||
import com.eternalcode.combat.fight.FightTask;
|
||||
import com.eternalcode.combat.fight.bossbar.FightBossBarService;
|
||||
import com.eternalcode.combat.fight.effect.FightEffectService;
|
||||
import com.eternalcode.combat.fight.logout.LogoutController;
|
||||
import com.eternalcode.combat.fight.logout.LogoutService;
|
||||
import com.eternalcode.combat.fight.pearl.FightPearlController;
|
||||
import com.eternalcode.combat.fight.pearl.FightPearlManager;
|
||||
import com.eternalcode.combat.fight.tagout.FightTagOutController;
|
||||
@@ -58,6 +58,7 @@ public final class CombatPlugin extends JavaPlugin implements EternalCombatApi {
|
||||
private FightPearlManager fightPearlManager;
|
||||
private FightTagOutService fightTagOutService;
|
||||
private FightEffectService fightEffectService;
|
||||
private LogoutService logoutService;
|
||||
private DropManager dropManager;
|
||||
private DropKeepInventoryManager dropKeepInventoryManager;
|
||||
private RegionProvider regionProvider;
|
||||
@@ -85,6 +86,7 @@ public final class CombatPlugin extends JavaPlugin implements EternalCombatApi {
|
||||
this.fightPearlManager = new FightPearlManager(this.pluginConfig.pearl);
|
||||
this.fightTagOutService = new FightTagOutService();
|
||||
this.fightEffectService = new FightEffectService();
|
||||
this.logoutService = new LogoutService();
|
||||
this.dropManager = new DropManager();
|
||||
this.dropKeepInventoryManager = new DropKeepInventoryManager();
|
||||
|
||||
@@ -122,15 +124,14 @@ public final class CombatPlugin extends JavaPlugin implements EternalCombatApi {
|
||||
|
||||
Stream.of(
|
||||
new PercentDropModifier(this.pluginConfig.dropSettings),
|
||||
new PlayersHealthDropModifier(this.pluginConfig.dropSettings)
|
||||
new PlayersHealthDropModifier(this.pluginConfig.dropSettings, this.logoutService)
|
||||
).forEach(this.dropManager::registerModifier);
|
||||
|
||||
Stream.of(
|
||||
new FightDeathCauseController(this.fightManager),
|
||||
new DropController(this.dropManager, this.dropKeepInventoryManager, this.pluginConfig.dropSettings, this.fightManager),
|
||||
new FightTagController(this.fightManager, this.pluginConfig, notificationAnnouncer),
|
||||
new FightUnTagController(this.fightManager, this.pluginConfig),
|
||||
new FightEscapeController(this.fightManager, this.pluginConfig, notificationAnnouncer),
|
||||
new FightTagController(this.fightManager, this.pluginConfig),
|
||||
new LogoutController(this.fightManager, this.logoutService, notificationAnnouncer, this.pluginConfig),
|
||||
new FightUnTagController(this.fightManager, this.pluginConfig, this.logoutService),
|
||||
new FightActionBlockerController(this.fightManager, notificationAnnouncer, this.pluginConfig),
|
||||
new FightPearlController(this.pluginConfig.pearl, notificationAnnouncer, this.fightManager, this.fightPearlManager),
|
||||
new UpdaterNotificationController(updaterService, this.pluginConfig, this.audienceProvider, miniMessage),
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
[versions]
|
||||
spigotApi = "1.20.2-R0.1-SNAPSHOT"
|
||||
|
||||
adventurePlatformBukkit = "4.3.2"
|
||||
adventureTextMinimessage = "4.15.0"
|
||||
|
||||
liteCommands = "2.8.9"
|
||||
|
||||
okaeriConfigsYamlBukkit = "5.0.0-beta.5"
|
||||
okaeriConfigsSerdesCommons = "5.0.0-beta.5"
|
||||
okaeriConfigsSerdesBukkit = "5.0.0-beta.5"
|
||||
|
||||
pandaUtilities = "0.5.2-alpha"
|
||||
gitCheck = "1.0.0"
|
||||
apacheCommons = "2.15.1"
|
||||
|
||||
caffeine = "3.0.4"
|
||||
|
||||
bStatsBukkit = "3.0.2"
|
||||
worldGuardBukkit = "7.0.9"
|
||||
|
||||
junitJupiterApi = "5.10.1"
|
||||
junitJupiterParams = "5.10.1"
|
||||
junitJupiterEngine = "5.10.1"
|
||||
|
||||
[libraries]
|
||||
spigotApi = { group = "org.spigotmc", name = "spigot-api", version.ref = "spigotApi" }
|
||||
|
||||
adventurePlatformBukkit = { group = "net.kyori", name = "adventure-platform-bukkit", version.ref = "adventurePlatformBukkit" }
|
||||
adventureTextMinimessage = { group = "net.kyori", name = "adventure-text-minimessage", version.ref = "adventureTextMinimessage" }
|
||||
|
||||
liteCommands = { group = "dev.rollczi.litecommands", name = "bukkit-adventure", version.ref = "liteCommands" }
|
||||
|
||||
okaeriConfigsYamlBukkit = { group = "eu.okaeri", name = "okaeri-configs-yaml-bukkit", version.ref = "okaeriConfigsYamlBukkit" }
|
||||
okaeriConfigsSerdesCommons = { group = "eu.okaeri", name = "okaeri-configs-serdes-commons", version.ref = "okaeriConfigsSerdesCommons" }
|
||||
okaeriConfigsSerdesBukkit = { group = "eu.okaeri", name = "okaeri-configs-serdes-bukkit", version.ref = "okaeriConfigsSerdesBukkit" }
|
||||
|
||||
pandaUtilities = { group = "org.panda-lang", name = "panda-utilities", version.ref = "pandaUtilities" }
|
||||
|
||||
gitCheck = { group = "com.eternalcode", name = "gitcheck", version.ref = "gitCheck" }
|
||||
|
||||
apacheCommons = { group = "commons-io", name = "commons-io", version.ref = "apacheCommons" }
|
||||
|
||||
bStatsBukkit = { group = "org.bstats", name = "bstats-bukkit", version.ref = "bStatsBukkit" }
|
||||
|
||||
worldGuardBukkit = { group = "com.sk89q.worldguard", name = "worldguard-bukkit", version.ref = "worldGuardBukkit" }
|
||||
|
||||
caffeine = { group = "com.github.ben-manes.caffeine", name = "caffeine", version.ref = "caffeine" }
|
||||
|
||||
jUnitJupiterApi = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "junitJupiterApi" }
|
||||
jUnitJupiterParams = { group = "org.junit.jupiter", name = "junit-jupiter-params", version.ref = "junitJupiterParams" }
|
||||
jUnitJupiterEngine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junitJupiterEngine" }
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -145,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
@@ -153,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -202,11 +202,11 @@ fi
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
|
||||
+10
-2
@@ -15,7 +15,15 @@
|
||||
"matchPackagePatterns": [
|
||||
"*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"groupName": "spigot dependencies",
|
||||
"groupSlug": "spigotmc",
|
||||
"matchPackagePatterns": [
|
||||
"org.spigotmc*"
|
||||
]
|
||||
}
|
||||
],
|
||||
"separateMajorMinor": false
|
||||
}
|
||||
"separateMajorMinor": true,
|
||||
"pruneStaleBranches": true
|
||||
}
|
||||
Reference in new issue
Block a user