Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6fb60e15a3 |
No files matched your search
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'com.gradleup.shadow' version "9.6.1"
|
id 'com.gradleup.shadow' version "8.3.5"
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
@@ -29,7 +29,7 @@ subprojects {
|
|||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain {
|
toolchain {
|
||||||
languageVersion = JavaLanguageVersion.of(25)
|
languageVersion = JavaLanguageVersion.of(21)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':core')
|
implementation project(':core')
|
||||||
|
|
||||||
compileOnly 'io.papermc.paper:paper-api:26.2.build.129-stable'
|
compileOnly 'io.papermc.paper:paper-api:1.21.10-R0.1-SNAPSHOT'
|
||||||
compileOnly 'org.geysermc.floodgate:api:2.2.4-SNAPSHOT'
|
compileOnly 'org.geysermc.floodgate:api:2.2.4-SNAPSHOT'
|
||||||
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
|
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
|
||||||
implementation 'com.sparkjava:spark-core:2.9.4'
|
implementation 'com.sparkjava:spark-core:2.9.4'
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ public class ChatMessages extends Appliance {
|
|||||||
public Component addReportActions(Component message, String username) {
|
public Component addReportActions(Component message, String username) {
|
||||||
return message
|
return message
|
||||||
.hoverEvent(HoverEvent.showText(Component.text("Klicke, um diesen Spieler zu reporten").color(NamedTextColor.GOLD)))
|
.hoverEvent(HoverEvent.showText(Component.text("Klicke, um diesen Spieler zu reporten").color(NamedTextColor.GOLD)))
|
||||||
.clickEvent(ClickEvent.suggestCommand(String.format("/report %s ", username)));
|
.clickEvent(ClickEvent.clickEvent(ClickEvent.Action.SUGGEST_COMMAND, String.format("/report %s ", username)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
-1
@@ -85,7 +85,7 @@ public class Report extends Appliance {
|
|||||||
.append(
|
.append(
|
||||||
Component
|
Component
|
||||||
.text(createdReport.data().url(), NamedTextColor.GRAY)
|
.text(createdReport.data().url(), NamedTextColor.GRAY)
|
||||||
.clickEvent(ClickEvent.openUrl(createdReport.data().url()))
|
.clickEvent(ClickEvent.clickEvent(ClickEvent.Action.OPEN_URL, createdReport.data().url()))
|
||||||
)
|
)
|
||||||
.appendNewline()
|
.appendNewline()
|
||||||
.appendNewline()
|
.appendNewline()
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ public class AntiFormattedBook extends Appliance {
|
|||||||
|
|
||||||
if (component instanceof TextComponent tc && tc.content().indexOf(SECTION) >= 0) return true;
|
if (component instanceof TextComponent tc && tc.content().indexOf(SECTION) >= 0) return true;
|
||||||
|
|
||||||
if (component instanceof NBTComponent<?> nbt) {
|
if (component instanceof NBTComponent<?, ?> nbt) {
|
||||||
if (nbt.separator() != null && this.hasFormattingDeep(nbt.separator())) return true;
|
if (nbt.separator() != null && this.hasFormattingDeep(nbt.separator())) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
dependencies {
|
dependencies {
|
||||||
compileOnly 'io.papermc.paper:paper-api:26.2.build.129-stable'
|
compileOnly 'io.papermc.paper:paper-api:1.21.10-R0.1-SNAPSHOT'
|
||||||
compileOnly 'org.geysermc.floodgate:api:2.2.4-SNAPSHOT'
|
compileOnly 'org.geysermc.floodgate:api:2.2.4-SNAPSHOT'
|
||||||
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
|
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
|
||||||
implementation 'com.sparkjava:spark-core:2.9.4'
|
implementation 'com.sparkjava:spark-core:2.9.4'
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class IteratorUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void times(int times, Runnable callback) {
|
public static void times(int times, Runnable callback) {
|
||||||
IntStream.range(0, times).forEach(_ -> callback.run());
|
IntStream.range(0, times).forEach(value -> callback.run());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> void iterateListInGlobal(int sectionStart, List<T> list, BiConsumer<Integer, T> callback) {
|
public static <T> void iterateListInGlobal(int sectionStart, List<T> list, BiConsumer<Integer, T> callback) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ dependencies {
|
|||||||
implementation project(':core')
|
implementation project(':core')
|
||||||
implementation project(':common')
|
implementation project(':common')
|
||||||
|
|
||||||
compileOnly 'io.papermc.paper:paper-api:26.2.build.129-stable'
|
compileOnly 'io.papermc.paper:paper-api:1.21.10-R0.1-SNAPSHOT'
|
||||||
compileOnly 'org.geysermc.floodgate:api:2.2.4-SNAPSHOT'
|
compileOnly 'org.geysermc.floodgate:api:2.2.4-SNAPSHOT'
|
||||||
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
|
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
|
||||||
implementation 'com.sparkjava:spark-core:2.9.4'
|
implementation 'com.sparkjava:spark-core:2.9.4'
|
||||||
|
|||||||
+52
@@ -0,0 +1,52 @@
|
|||||||
|
package eu.mhsl.craftattack.spawn.craftattack.appliances.gameplay.frostWalkerBoat;
|
||||||
|
|
||||||
|
import eu.mhsl.craftattack.spawn.core.appliance.ApplianceListener;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.block.data.Levelled;
|
||||||
|
import org.bukkit.entity.Boat;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.vehicle.VehicleMoveEvent;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
class BoatMoveListener extends ApplianceListener<FrostWalkerBoat> {
|
||||||
|
@EventHandler
|
||||||
|
public void onBoatMove(VehicleMoveEvent event) {
|
||||||
|
if(!(event.getVehicle() instanceof Boat boat)) return;
|
||||||
|
|
||||||
|
// if(!event.getVehicle().getPersistentDataContainer().has(
|
||||||
|
// this.getAppliance().getNamespacedKey(),
|
||||||
|
// PersistentDataType.BOOLEAN)
|
||||||
|
// ) return;
|
||||||
|
//
|
||||||
|
// if(Boolean.FALSE.equals(event.getVehicle().getPersistentDataContainer().get(
|
||||||
|
// this.getAppliance().getNamespacedKey(),
|
||||||
|
// PersistentDataType.BOOLEAN
|
||||||
|
// ))) return;
|
||||||
|
|
||||||
|
Block blockAtBoat = event.getTo().getBlock();
|
||||||
|
|
||||||
|
if(blockAtBoat.getType() == Material.WATER) {
|
||||||
|
if (!(blockAtBoat.getBlockData() instanceof Levelled waterData)) return;
|
||||||
|
if (waterData.getLevel() != 0) return;
|
||||||
|
if (!blockAtBoat.getRelative(BlockFace.UP).isEmpty()) return;
|
||||||
|
|
||||||
|
Location teleportLocation = event.getTo().clone();
|
||||||
|
teleportLocation.setY(blockAtBoat.getY()+1.1);
|
||||||
|
boat.teleport(teleportLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector velocity = event.getTo().toVector().subtract(event.getFrom().toVector());
|
||||||
|
velocity.setY(0);
|
||||||
|
Block iceTargetBlock;
|
||||||
|
if(velocity.isZero()) {
|
||||||
|
iceTargetBlock = event.getTo().getBlock().getRelative(BlockFace.DOWN);
|
||||||
|
} else {
|
||||||
|
Location iceTargetLocation = blockAtBoat.getLocation().clone().add(velocity.clone().normalize().multiply(5));
|
||||||
|
iceTargetBlock = iceTargetLocation.getBlock().getRelative(BlockFace.DOWN);
|
||||||
|
}
|
||||||
|
this.getAppliance().freezeWater(iceTargetBlock);
|
||||||
|
}
|
||||||
|
}
|
||||||
+47
@@ -0,0 +1,47 @@
|
|||||||
|
package eu.mhsl.craftattack.spawn.craftattack.appliances.gameplay.frostWalkerBoat;
|
||||||
|
|
||||||
|
import eu.mhsl.craftattack.spawn.core.appliance.Appliance;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.block.data.Levelled;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class FrostWalkerBoat extends Appliance {
|
||||||
|
public NamespacedKey getNamespacedKey() {
|
||||||
|
return new NamespacedKey(this.getClass().getSimpleName().toLowerCase(), "is_frostwalker_enchanted");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void freezeWater(Block targetBlock) {
|
||||||
|
int radius = 4;
|
||||||
|
double circleRadiusSquared = Math.pow(radius + 0.5, 2);
|
||||||
|
|
||||||
|
for(int xOffset = -radius; xOffset <= radius; xOffset++) {
|
||||||
|
for(int zOffset = -radius; zOffset <= radius; zOffset++) {
|
||||||
|
int distanceSquared =
|
||||||
|
xOffset * xOffset + zOffset * zOffset;
|
||||||
|
|
||||||
|
if(distanceSquared > circleRadiusSquared) continue;
|
||||||
|
|
||||||
|
Block block = targetBlock.getRelative(xOffset, 0, zOffset);
|
||||||
|
|
||||||
|
if(block.getType() != Material.WATER) continue;
|
||||||
|
if(!(block.getBlockData() instanceof Levelled waterData)) continue;
|
||||||
|
if(waterData.getLevel() != 0) continue;
|
||||||
|
if(!block.getRelative(BlockFace.UP).isEmpty()) continue;
|
||||||
|
|
||||||
|
block.setType(Material.FROSTED_ICE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@NotNull
|
||||||
|
protected List<Listener> listeners() {
|
||||||
|
return List.of(new BoatMoveListener());
|
||||||
|
}
|
||||||
|
}
|
||||||
-48
@@ -1,48 +0,0 @@
|
|||||||
package eu.mhsl.craftattack.spawn.craftattack.appliances.gameplay.newYearFirework;
|
|
||||||
|
|
||||||
import eu.mhsl.craftattack.spawn.core.appliance.Appliance;
|
|
||||||
import org.bukkit.Color;
|
|
||||||
import org.bukkit.FireworkEffect;
|
|
||||||
import org.bukkit.NamespacedKey;
|
|
||||||
import org.bukkit.entity.Firework;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.inventory.meta.FireworkMeta;
|
|
||||||
import org.bukkit.persistence.PersistentDataType;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class NewYearFirework extends Appliance {
|
|
||||||
private static final String namespace = NewYearFirework.class.getSimpleName().toLowerCase(Locale.ROOT);
|
|
||||||
public static NamespacedKey fireworkKey = new NamespacedKey(namespace, "newyear_firework".toLowerCase());
|
|
||||||
|
|
||||||
public void spawnFirework(Player player) {
|
|
||||||
for (int i = 0; i < 5; i++) {
|
|
||||||
Firework firework = player.getWorld().spawn(player.getLocation(), Firework.class);
|
|
||||||
firework.getPersistentDataContainer().set(fireworkKey, PersistentDataType.BOOLEAN, true);
|
|
||||||
FireworkMeta fireworkMeta = firework.getFireworkMeta();
|
|
||||||
fireworkMeta.addEffect(FireworkEffect.builder()
|
|
||||||
.with(FireworkEffect.Type.BALL)
|
|
||||||
.withColor(Color.AQUA, Color.RED, Color.LIME, Color.ORANGE, Color.YELLOW)
|
|
||||||
.withFade(Color.FUCHSIA, Color.WHITE)
|
|
||||||
.trail(true)
|
|
||||||
.flicker(true)
|
|
||||||
.build()
|
|
||||||
);
|
|
||||||
fireworkMeta.setPower((int) (i % 3 + 0.25));
|
|
||||||
firework.setFireworkMeta(fireworkMeta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean shouldSpawnFirework() {
|
|
||||||
return LocalDate.now().getDayOfYear() == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected @NotNull List<Listener> listeners() {
|
|
||||||
return List.of(new NewYearFireworkListener());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-21
@@ -1,21 +0,0 @@
|
|||||||
package eu.mhsl.craftattack.spawn.craftattack.appliances.gameplay.newYearFirework;
|
|
||||||
|
|
||||||
import eu.mhsl.craftattack.spawn.core.appliance.ApplianceListener;
|
|
||||||
import org.bukkit.entity.Firework;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
|
||||||
|
|
||||||
class NewYearFireworkListener extends ApplianceListener<NewYearFirework> {
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
|
||||||
if(!this.getAppliance().shouldSpawnFirework()) return;
|
|
||||||
this.getAppliance().spawnFirework(event.getPlayer());
|
|
||||||
}
|
|
||||||
@EventHandler
|
|
||||||
public void onDamage(EntityDamageByEntityEvent event) {
|
|
||||||
if(!(event.getDamager() instanceof Firework firework)) return;
|
|
||||||
if(!firework.getPersistentDataContainer().has(NewYearFirework.fireworkKey)) return;
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-42
@@ -1,42 +0,0 @@
|
|||||||
package eu.mhsl.craftattack.spawn.craftattack.appliances.gameplay.quarzRecipe;
|
|
||||||
|
|
||||||
import eu.mhsl.craftattack.spawn.core.Main;
|
|
||||||
import eu.mhsl.craftattack.spawn.core.appliance.Appliance;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.NamespacedKey;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.ShapelessRecipe;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class QuarzRecipe extends Appliance {
|
|
||||||
private NamespacedKey recipeKey;
|
|
||||||
@Override
|
|
||||||
public void onEnable() {
|
|
||||||
this.recipeKey = new NamespacedKey(Main.instance(), "quarz_block_to_quarz");
|
|
||||||
|
|
||||||
ShapelessRecipe recipe = new ShapelessRecipe(this.recipeKey, new ItemStack(Material.QUARTZ, 4));
|
|
||||||
recipe.addIngredient(Material.QUARTZ_BLOCK);
|
|
||||||
|
|
||||||
Bukkit.addRecipe(recipe);
|
|
||||||
Bukkit.getOnlinePlayers().forEach(this::unlock);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDisable() {
|
|
||||||
Bukkit.removeRecipe(this.recipeKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void unlock(Player player) {
|
|
||||||
player.discoverRecipe(this.recipeKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected @NotNull List<Listener> listeners() {
|
|
||||||
return List.of(new QuarzRecipeListener());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-12
@@ -1,12 +0,0 @@
|
|||||||
package eu.mhsl.craftattack.spawn.craftattack.appliances.gameplay.quarzRecipe;
|
|
||||||
|
|
||||||
import eu.mhsl.craftattack.spawn.core.appliance.ApplianceListener;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
|
||||||
|
|
||||||
class QuarzRecipeListener extends ApplianceListener<QuarzRecipe> {
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
|
||||||
this.getAppliance().unlock(event.getPlayer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-45
@@ -1,45 +0,0 @@
|
|||||||
package eu.mhsl.craftattack.spawn.craftattack.appliances.metaGameplay.antiPlayerLootDespawn;
|
|
||||||
|
|
||||||
import eu.mhsl.craftattack.spawn.core.appliance.Appliance;
|
|
||||||
import org.bukkit.NamespacedKey;
|
|
||||||
import org.bukkit.entity.Item;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.persistence.PersistentDataType;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class AntiPlayerLootDespawn extends Appliance {
|
|
||||||
private static final int extraCycles = 5;
|
|
||||||
private static final String namespace = AntiPlayerLootDespawnListener.class.getSimpleName().toLowerCase(Locale.ROOT);
|
|
||||||
public static NamespacedKey cyclesKey = new NamespacedKey(namespace, "item_deaths_cycles".toLowerCase());
|
|
||||||
|
|
||||||
public void markItems(List<ItemStack> item) {
|
|
||||||
item.forEach(itemStack ->
|
|
||||||
itemStack.editPersistentDataContainer(persistentDataContainer ->
|
|
||||||
persistentDataContainer.set(cyclesKey, PersistentDataType.INTEGER, extraCycles)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isItemAboveMaxAge(Item item) {
|
|
||||||
ItemStack itemStack = item.getItemStack();
|
|
||||||
|
|
||||||
int cycles = itemStack.getPersistentDataContainer()
|
|
||||||
.getOrDefault(AntiPlayerLootDespawn.cyclesKey, PersistentDataType.INTEGER, 0);
|
|
||||||
|
|
||||||
itemStack.editPersistentDataContainer(data ->
|
|
||||||
data.set(AntiPlayerLootDespawn.cyclesKey, PersistentDataType.INTEGER, cycles - 1)
|
|
||||||
);
|
|
||||||
|
|
||||||
item.setItemStack(itemStack);
|
|
||||||
return cycles > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected @NotNull List<Listener> listeners() {
|
|
||||||
return List.of(new AntiPlayerLootDespawnListener());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
package eu.mhsl.craftattack.spawn.craftattack.appliances.metaGameplay.antiPlayerLootDespawn;
|
|
||||||
|
|
||||||
import eu.mhsl.craftattack.spawn.core.appliance.ApplianceListener;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.entity.ItemDespawnEvent;
|
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
|
||||||
|
|
||||||
class AntiPlayerLootDespawnListener extends ApplianceListener<AntiPlayerLootDespawn> {
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onDeath(PlayerDeathEvent event) {
|
|
||||||
this.getAppliance().markItems(event.getDrops());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onItemDespawn(ItemDespawnEvent event) {
|
|
||||||
event.setCancelled(this.getAppliance().isItemAboveMaxAge(event.getEntity()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-1
@@ -20,7 +20,7 @@ import org.bukkit.event.Event;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentSkipListMap;
|
import java.util.concurrent.ConcurrentSkipListMap;
|
||||||
|
|||||||
+16
-20
@@ -26,8 +26,10 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static java.util.Map.entry;
|
||||||
import static org.bukkit.Sound.MUSIC_DISC_LAVA_CHICKEN;
|
import static org.bukkit.Sound.MUSIC_DISC_LAVA_CHICKEN;
|
||||||
|
|
||||||
public class ProjectStart extends Appliance {
|
public class ProjectStart extends Appliance {
|
||||||
@@ -55,23 +57,17 @@ public class ProjectStart extends Appliance {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
private record GameRuleSetting<T>(GameRule<T> rule, T before, T after) {
|
private final Map<GameRule<Boolean>, Boolean> gameRulesAfterStart = Map.ofEntries(
|
||||||
void apply(boolean afterStart) {
|
entry(GameRule.DO_DAYLIGHT_CYCLE, true),
|
||||||
IteratorUtil.worlds(world -> world.setGameRule(this.rule, afterStart ? this.after : this.before));
|
entry(GameRule.DO_INSOMNIA, true),
|
||||||
}
|
entry(GameRule.DISABLE_RAIDS, false),
|
||||||
}
|
entry(GameRule.DO_FIRE_TICK, true),
|
||||||
|
entry(GameRule.DO_ENTITY_DROPS, true),
|
||||||
private final List<GameRuleSetting<?>> gameRules = List.of(
|
entry(GameRule.DO_PATROL_SPAWNING, true),
|
||||||
new GameRuleSetting<>(GameRules.ADVANCE_TIME, false, true),
|
entry(GameRule.DO_TRADER_SPAWNING, true),
|
||||||
new GameRuleSetting<>(GameRules.SPAWN_PHANTOMS, false, true),
|
entry(GameRule.DO_WEATHER_CYCLE, true),
|
||||||
new GameRuleSetting<>(GameRules.RAIDS, false, true),
|
entry(GameRule.FALL_DAMAGE, true),
|
||||||
new GameRuleSetting<>(GameRules.ENTITY_DROPS, false, true),
|
entry(GameRule.FIRE_DAMAGE, true)
|
||||||
new GameRuleSetting<>(GameRules.SPAWN_PATROLS, false, true),
|
|
||||||
new GameRuleSetting<>(GameRules.SPAWN_WANDERING_TRADERS, false, true),
|
|
||||||
new GameRuleSetting<>(GameRules.ADVANCE_WEATHER, false, true),
|
|
||||||
new GameRuleSetting<>(GameRules.FALL_DAMAGE, false, true),
|
|
||||||
new GameRuleSetting<>(GameRules.FIRE_DAMAGE, false, true),
|
|
||||||
new GameRuleSetting<>(GameRules.FIRE_SPREAD_RADIUS_AROUND_PLAYER, 0, -1)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
public ProjectStart() {
|
public ProjectStart() {
|
||||||
@@ -80,7 +76,7 @@ public class ProjectStart extends Appliance {
|
|||||||
this.countdown.addCustomAnnouncement(
|
this.countdown.addCustomAnnouncement(
|
||||||
new Countdown.CustomAnnouncements(
|
new Countdown.CustomAnnouncements(
|
||||||
counter -> counter == this.startMusicAt,
|
counter -> counter == this.startMusicAt,
|
||||||
_ -> this.glassLocation
|
counter -> this.glassLocation
|
||||||
.getWorld()
|
.getWorld()
|
||||||
.playSound(this.glassLocation, MUSIC_DISC_LAVA_CHICKEN, SoundCategory.RECORDS, 500f, 1f)
|
.playSound(this.glassLocation, MUSIC_DISC_LAVA_CHICKEN, SoundCategory.RECORDS, 500f, 1f)
|
||||||
)
|
)
|
||||||
@@ -125,7 +121,7 @@ public class ProjectStart extends Appliance {
|
|||||||
this.setEnabled(false);
|
this.setEnabled(false);
|
||||||
|
|
||||||
IteratorUtil.worlds(World::getWorldBorder, worldBorder -> worldBorder.setSize(worldBorder.getMaxSize()));
|
IteratorUtil.worlds(World::getWorldBorder, worldBorder -> worldBorder.setSize(worldBorder.getMaxSize()));
|
||||||
this.gameRules.forEach(setting -> setting.apply(true));
|
IteratorUtil.worlds(world -> IteratorUtil.setGameRules(this.gameRulesAfterStart, false));
|
||||||
Bukkit.getWorlds().getFirst().setFullTime(0);
|
Bukkit.getWorlds().getFirst().setFullTime(0);
|
||||||
|
|
||||||
this.netherFireLocations.forEach(location -> Objects.requireNonNull(this.startWorld).getBlockAt(location).setType(Material.FIRE));
|
this.netherFireLocations.forEach(location -> Objects.requireNonNull(this.startWorld).getBlockAt(location).setType(Material.FIRE));
|
||||||
@@ -172,7 +168,7 @@ public class ProjectStart extends Appliance {
|
|||||||
worldBorder.setDamageAmount(0);
|
worldBorder.setDamageAmount(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.gameRules.forEach(setting -> setting.apply(false));
|
IteratorUtil.worlds(world -> world, world -> IteratorUtil.setGameRules(this.gameRulesAfterStart, true));
|
||||||
this.resetAdvancements();
|
this.resetAdvancements();
|
||||||
|
|
||||||
this.blockCycle.reset();
|
this.blockCycle.reset();
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ dependencies {
|
|||||||
implementation project(':common')
|
implementation project(':common')
|
||||||
implementation project(':core')
|
implementation project(':core')
|
||||||
|
|
||||||
compileOnly 'io.papermc.paper:paper-api:26.2.build.129-stable'
|
compileOnly 'io.papermc.paper:paper-api:1.21.10-R0.1-SNAPSHOT'
|
||||||
compileOnly 'org.geysermc.floodgate:api:2.2.4-SNAPSHOT'
|
compileOnly 'org.geysermc.floodgate:api:2.2.4-SNAPSHOT'
|
||||||
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
|
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
|
||||||
implementation 'com.sparkjava:spark-core:2.9.4'
|
implementation 'com.sparkjava:spark-core:2.9.4'
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
tasks.register('deployVaroPlugin', Copy) {
|
tasks.register('deployVaroPlugin', Copy) {
|
||||||
dependsOn ":varo:shadowJar"
|
dependsOn ":varo:shadowJar"
|
||||||
from { project(":varo").shadowJar.archiveFile }
|
from { project(":varo").shadowJar.archivePath }
|
||||||
into file('path') // path to plugins folder
|
into file('path') // path to plugins folder
|
||||||
rename { fileName -> "varo.jar" }
|
rename { fileName -> "varo.jar" }
|
||||||
}
|
}
|
||||||
@@ -10,15 +10,15 @@ tasks.register("uploadVaroPlugin") {
|
|||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
def jarFile = project(":varo").tasks.named("shadowJar").get().outputs.files.singleFile
|
def jarFile = project(":varo").tasks.named("shadowJar").get().outputs.files.singleFile
|
||||||
providers.exec {
|
exec {
|
||||||
commandLine "scp", "-4", "-P", "22", jarFile.absolutePath, "user@host:path/varo.jar"
|
commandLine "scp", "-4", "-P", "22", jarFile.absolutePath, "user@host:path/varo.jar"
|
||||||
}.result.get()
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register('deployCraftAttackPlugin', Copy) {
|
tasks.register('deployCraftAttackPlugin', Copy) {
|
||||||
dependsOn ":craftattack:shadowJar"
|
dependsOn ":craftattack:shadowJar"
|
||||||
from { project(":craftattack").shadowJar.archiveFile }
|
from { project(":craftattack").shadowJar.archivePath }
|
||||||
into file('path') // path to plugins folder
|
into file('path') // path to plugins folder
|
||||||
rename { fileName -> "craftattack.jar" }
|
rename { fileName -> "craftattack.jar" }
|
||||||
}
|
}
|
||||||
+1
-1
@@ -2,7 +2,7 @@ dependencies {
|
|||||||
implementation project(':core')
|
implementation project(':core')
|
||||||
implementation project(':common')
|
implementation project(':common')
|
||||||
|
|
||||||
compileOnly 'io.papermc.paper:paper-api:26.2.build.129-stable'
|
compileOnly 'io.papermc.paper:paper-api:1.21.10-R0.1-SNAPSHOT'
|
||||||
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
|
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
|
||||||
implementation 'com.sparkjava:spark-core:2.9.4'
|
implementation 'com.sparkjava:spark-core:2.9.4'
|
||||||
}
|
}
|
||||||
+1
-1
@@ -11,7 +11,7 @@ import org.bukkit.event.player.PlayerItemConsumeEvent;
|
|||||||
import org.bukkit.inventory.meta.PotionMeta;
|
import org.bukkit.inventory.meta.PotionMeta;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
class ForbiddenPotionsListener extends ApplianceListener<ForbiddenItems> {
|
class ForbiddenPotionsListener extends ApplianceListener<ForbiddenItems> {
|
||||||
|
|||||||
Reference in new issue
Block a user