Compare commits
11 Commits
8736e78adf
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 323e316f0f | |||
| 0a16e1e049 | |||
| c371893407 | |||
| f2bf8f1858 | |||
| a0a33f1f56 | |||
| 164a160dbb | |||
| efdbc6fe9f | |||
| 7ac02b4ec4 | |||
| 93971650ce | |||
| 336e3f934c | |||
| 91e350ee62 |
@@ -19,7 +19,7 @@ public class HelpCommand extends ApplianceCommand<Help> {
|
||||
Component.text("Willkommen auf Craftattack!", NamedTextColor.GOLD)
|
||||
.appendNewline()
|
||||
.append(Component.text("Wenn du hilfe benötigst kannst du dich jederzeit an einen Admin wenden." +
|
||||
" Weitere Informationen zu Funktionen und Befehlen erhältst du zudem im Turm am Spawn.", NamedTextColor.GRAY))
|
||||
" Weitere Informationen zu Funktionen und Befehlen erhältst du zudem am Spawn.", NamedTextColor.GRAY))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -46,7 +47,7 @@ class ReportCommand extends ApplianceCommand.PlayerChecked<Report> {
|
||||
response = Stream.concat(
|
||||
Bukkit.getOnlinePlayers().stream().map(Player::getName),
|
||||
Arrays.stream(Bukkit.getOfflinePlayers()).map(OfflinePlayer::getName)
|
||||
).toList();
|
||||
).filter(Objects::nonNull).distinct().toList();
|
||||
}
|
||||
|
||||
if(args.length == 2) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Boat;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Appliance.Flags(enabled = false)
|
||||
public class AntiBoatFreecam extends Appliance {
|
||||
private static final float MAX_YAW_OFFSET = 106.0f;
|
||||
|
||||
|
||||
@@ -5,23 +5,18 @@ import eu.mhsl.craftattack.spawn.core.Main;
|
||||
import eu.mhsl.craftattack.spawn.core.appliance.Appliance;
|
||||
import eu.mhsl.craftattack.spawn.core.appliance.ApplianceCommand;
|
||||
import eu.mhsl.craftattack.spawn.craftattack.appliances.gameplay.bloodmoon.commands.BloodmoonCommand;
|
||||
import eu.mhsl.craftattack.spawn.craftattack.appliances.gameplay.bloodmoon.listener.BloodmoonEntityDamageListener;
|
||||
import eu.mhsl.craftattack.spawn.craftattack.appliances.gameplay.bloodmoon.listener.BloodmoonMonsterDeathListener;
|
||||
import eu.mhsl.craftattack.spawn.craftattack.appliances.gameplay.bloodmoon.listener.BloodmoonPlayerJoinListener;
|
||||
import eu.mhsl.craftattack.spawn.craftattack.appliances.gameplay.bloodmoon.listener.BloodmoonTimeListener;
|
||||
import eu.mhsl.craftattack.spawn.craftattack.appliances.gameplay.bloodmoon.listener.*;
|
||||
import net.kyori.adventure.bossbar.BossBar;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.format.TextDecoration;
|
||||
import net.kyori.adventure.util.Ticks;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
@@ -70,7 +65,6 @@ public class Bloodmoon extends Appliance {
|
||||
public final double mobHealthMultiplier = 2;
|
||||
|
||||
private final ThreadLocalRandom random = ThreadLocalRandom.current();
|
||||
private boolean isActive = false;
|
||||
private final BossBar bossBar = BossBar.bossBar(
|
||||
Component.text("Blutmond", NamedTextColor.DARK_RED),
|
||||
1f,
|
||||
@@ -79,6 +73,7 @@ public class Bloodmoon extends Appliance {
|
||||
Set.of(BossBar.Flag.CREATE_WORLD_FOG, BossBar.Flag.DARKEN_SCREEN)
|
||||
);
|
||||
private final boolean hordesEnabled = true;
|
||||
public final boolean bloodmoonSkippable = true;
|
||||
private final int hordeSpawnRateTicks = 40 * Ticks.TICKS_PER_SECOND;
|
||||
private final int hordeSpawnRateVariationTicks = 40 * Ticks.TICKS_PER_SECOND;
|
||||
private final int hordeMinPopulation = 3;
|
||||
@@ -90,10 +85,10 @@ public class Bloodmoon extends Appliance {
|
||||
EntityType.SPIDER
|
||||
);
|
||||
private final Map<Player, @Nullable BukkitTask> hordeSpawnTasks = new WeakHashMap<>();
|
||||
private long lastBloodmoonStartTick = 0;
|
||||
public final int ticksPerDay = 24000;
|
||||
public final int bloodmoonLength = this.ticksPerDay / 2;
|
||||
public final int preStartMessageTicks = Ticks.TICKS_PER_SECOND * 50;
|
||||
private boolean bossbarActive = false;
|
||||
private final int bloodmoonFreeDaysAtStart = 3;
|
||||
private final int bloodmoonStartTime = this.ticksPerDay /2;
|
||||
private final int bloodmoonDayInterval = 30;
|
||||
@@ -113,35 +108,71 @@ public class Bloodmoon extends Appliance {
|
||||
}
|
||||
|
||||
public boolean bloodmoonIsActive() {
|
||||
return this.isActive;
|
||||
long currentTick = Bukkit.getWorlds().getFirst().getFullTime();
|
||||
long day = currentTick / this.ticksPerDay;
|
||||
if(day % this.bloodmoonDayInterval != 0 || day - this.bloodmoonFreeDaysAtStart <= 0) return false;
|
||||
long time = currentTick % this.ticksPerDay;
|
||||
return time >= this.bloodmoonStartTime && time <= this.bloodmoonStartTime + this.bloodmoonLength;
|
||||
}
|
||||
|
||||
public void startBloodmoon(long startTick) {
|
||||
this.lastBloodmoonStartTick = startTick;
|
||||
this.isActive = true;
|
||||
public void startBloodmoon() {
|
||||
this.bossbarActive = true;
|
||||
Bukkit.getOnlinePlayers().forEach(this::addPlayerToBossBar);
|
||||
this.startHordeSpawning(this.getRandomHordeSpawnDelay());
|
||||
this.sendStartMessages();
|
||||
}
|
||||
|
||||
public void stopBloodmoon() {
|
||||
this.isActive = false;
|
||||
public void stopBloodmoonIfInactive() {
|
||||
Bukkit.getScheduler().runTaskLater(
|
||||
Main.instance(),
|
||||
() -> {
|
||||
if(!this.bossbarActive) return;
|
||||
if(this.bloodmoonIsActive()) return;
|
||||
this.bossbarActive = false;
|
||||
Bukkit.getOnlinePlayers().forEach(player -> player.hideBossBar(this.bossBar));
|
||||
this.stopHordeSpawning();
|
||||
this.sendStopMessages();
|
||||
},
|
||||
1
|
||||
);
|
||||
}
|
||||
|
||||
// not working for entity effects and debuffs...
|
||||
public void forceStopBloodmoon() {
|
||||
this.bossbarActive = false;
|
||||
Bukkit.getOnlinePlayers().forEach(player -> player.hideBossBar(this.bossBar));
|
||||
this.stopHordeSpawning();
|
||||
this.sendStopMessages();
|
||||
}
|
||||
|
||||
public void updateBossBar() {
|
||||
long tick = Bukkit.getWorlds().getFirst().getFullTime();
|
||||
long sinceStart = tick - this.lastBloodmoonStartTick;
|
||||
long sinceStart = tick - this.lastBloodmoonStartTick();
|
||||
float progress = 1f - ((float) sinceStart / this.bloodmoonLength);
|
||||
if(progress < 0) progress = 1f;
|
||||
this.bossBar.progress(progress);
|
||||
}
|
||||
|
||||
private long lastBloodmoonStartTick() {
|
||||
long currentTick = Bukkit.getWorlds().getFirst().getFullTime();
|
||||
long day = currentTick / this.ticksPerDay;
|
||||
long time = currentTick % this.ticksPerDay;
|
||||
|
||||
boolean todayIsBloodmoon = (day % this.bloodmoonDayInterval == 0) && (day > this.bloodmoonFreeDaysAtStart);
|
||||
if (todayIsBloodmoon && time < this.bloodmoonStartTime) {
|
||||
day -= this.bloodmoonDayInterval;
|
||||
} else if (!todayIsBloodmoon) {
|
||||
day -= (day % this.bloodmoonDayInterval);
|
||||
}
|
||||
|
||||
if (day <= this.bloodmoonFreeDaysAtStart) return -1L;
|
||||
return day * this.ticksPerDay + this.bloodmoonStartTime;
|
||||
}
|
||||
|
||||
public boolean isStartTick(long tick) {
|
||||
long day = tick / this.ticksPerDay;
|
||||
if(day % this.bloodmoonDayInterval != 0 || day - this.bloodmoonFreeDaysAtStart <= 0) return false;
|
||||
long time = tick - (day * this.ticksPerDay);
|
||||
if(day % this.bloodmoonDayInterval != 0 || day <= this.bloodmoonFreeDaysAtStart) return false;
|
||||
long time = tick % this.ticksPerDay;
|
||||
return time == this.bloodmoonStartTime;
|
||||
}
|
||||
|
||||
@@ -153,7 +184,14 @@ public class Bloodmoon extends Appliance {
|
||||
Bukkit.getOnlinePlayers().forEach(player -> this.startHordeSpawning(delay, player));
|
||||
}
|
||||
|
||||
private void startHordeSpawning(int delay, Player player) {
|
||||
private void stopHordeSpawning() {
|
||||
this.hordeSpawnTasks.forEach((player, bukkitTask) -> {
|
||||
@Nullable BukkitTask task = this.hordeSpawnTasks.get(player);
|
||||
if(task != null) task.cancel();
|
||||
});
|
||||
}
|
||||
|
||||
public void startHordeSpawning(int delay, Player player) {
|
||||
@Nullable BukkitTask task = this.hordeSpawnTasks.get(player);
|
||||
if(task != null) task.cancel();
|
||||
BukkitTask newTask = Bukkit.getScheduler().runTaskLater(
|
||||
@@ -187,14 +225,17 @@ public class Bloodmoon extends Appliance {
|
||||
|
||||
public void spawnRandomHorde(Player player) {
|
||||
if(!this.hordesEnabled) return;
|
||||
if(!this.getBloodmoonSetting(player)) return;
|
||||
if(!player.getGameMode().equals(GameMode.SURVIVAL)) return;
|
||||
|
||||
EntityType hordeEntityType = this.hordeMobList.get(this.random.nextInt(this.hordeMobList.size()));
|
||||
if(player.getLocation().getWorld().getEnvironment().equals(World.Environment.THE_END)) hordeEntityType = EntityType.ENDERMITE;
|
||||
int hordeSize = this.random.nextInt(this.hordeMinPopulation, this.hordeMaxPopulation + 1);
|
||||
this.spawnHorde(player, hordeSize, hordeEntityType);
|
||||
}
|
||||
|
||||
public void sendWarningMessage(Player p) {
|
||||
if(!this.getBloodmoonSetting(p)) return;
|
||||
p.sendMessage(Component.text("Der Blutmond waltet in diesem Augenblick!", NamedTextColor.RED));
|
||||
}
|
||||
|
||||
@@ -215,7 +256,7 @@ public class Bloodmoon extends Appliance {
|
||||
Math.cos(spawnRadiant)*this.hordeSpawnDistance
|
||||
);
|
||||
mobSpawnLocation.setY(player.getWorld().getHighestBlockYAt(mobSpawnLocation) + 1);
|
||||
player.getWorld().spawnEntity(mobSpawnLocation, type);
|
||||
player.getWorld().spawnEntity(mobSpawnLocation, type, CreatureSpawnEvent.SpawnReason.NATURAL);
|
||||
player.getWorld().strikeLightningEffect(mobSpawnLocation);
|
||||
}
|
||||
}
|
||||
@@ -269,7 +310,8 @@ public class Bloodmoon extends Appliance {
|
||||
new BloodmoonMonsterDeathListener(),
|
||||
new BloodmoonPlayerJoinListener(),
|
||||
new BloodmoonEntityDamageListener(),
|
||||
new BloodmoonTimeListener()
|
||||
new BloodmoonTimeListener(),
|
||||
new BloodmoonTimeSkipListener()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package eu.mhsl.craftattack.spawn.craftattack.appliances.gameplay.bloodmoon.comm
|
||||
|
||||
import eu.mhsl.craftattack.spawn.core.appliance.ApplianceCommand;
|
||||
import eu.mhsl.craftattack.spawn.craftattack.appliances.gameplay.bloodmoon.Bloodmoon;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -23,15 +24,19 @@ public class BloodmoonCommand extends ApplianceCommand<Bloodmoon> {
|
||||
|
||||
switch(args[0]) {
|
||||
case "start": {
|
||||
this.getAppliance().startBloodmoon(0L);
|
||||
this.getAppliance().startBloodmoon();
|
||||
sender.sendMessage("Started bloodmoon.");
|
||||
break;
|
||||
}
|
||||
case "stop": {
|
||||
this.getAppliance().stopBloodmoon();
|
||||
this.getAppliance().forceStopBloodmoon();
|
||||
sender.sendMessage("Stopped bloodmoon.");
|
||||
break;
|
||||
}
|
||||
case "time": {
|
||||
sender.sendMessage(String.valueOf(Bukkit.getWorlds().getFirst().getFullTime()));
|
||||
break;
|
||||
}
|
||||
default: throw new Error("No such option: '%s' !".formatted(args[0]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package eu.mhsl.craftattack.spawn.craftattack.appliances.gameplay.bloodmoon.list
|
||||
|
||||
import eu.mhsl.craftattack.spawn.core.appliance.ApplianceListener;
|
||||
import eu.mhsl.craftattack.spawn.craftattack.appliances.gameplay.bloodmoon.Bloodmoon;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
@@ -9,7 +10,9 @@ public class BloodmoonPlayerJoinListener extends ApplianceListener<Bloodmoon> {
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
if(!this.getAppliance().bloodmoonIsActive()) return;
|
||||
this.getAppliance().addPlayerToBossBar(event.getPlayer());
|
||||
this.getAppliance().sendWarningMessage(event.getPlayer());
|
||||
Player player = event.getPlayer();
|
||||
this.getAppliance().addPlayerToBossBar(player);
|
||||
this.getAppliance().startHordeSpawning(1500, player);
|
||||
this.getAppliance().sendWarningMessage(player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,11 +12,11 @@ public class BloodmoonTimeListener extends ApplianceListener<Bloodmoon> {
|
||||
public void onServerTick(ServerTickStartEvent event) {
|
||||
long currentTime = Bukkit.getWorlds().getFirst().getFullTime();
|
||||
if(this.getAppliance().isStartTick(currentTime)) {
|
||||
this.getAppliance().startBloodmoon(currentTime);
|
||||
this.getAppliance().startBloodmoon();
|
||||
return;
|
||||
}
|
||||
if(this.getAppliance().isStartTick(currentTime - this.getAppliance().bloodmoonLength)) {
|
||||
this.getAppliance().stopBloodmoon();
|
||||
this.getAppliance().stopBloodmoonIfInactive();
|
||||
return;
|
||||
}
|
||||
if(currentTime % Ticks.TICKS_PER_SECOND == 0 && this.getAppliance().bloodmoonIsActive()) this.getAppliance().updateBossBar();
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package eu.mhsl.craftattack.spawn.craftattack.appliances.gameplay.bloodmoon.listener;
|
||||
|
||||
import eu.mhsl.craftattack.spawn.core.appliance.ApplianceListener;
|
||||
import eu.mhsl.craftattack.spawn.craftattack.appliances.gameplay.bloodmoon.Bloodmoon;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerBedEnterEvent;
|
||||
import org.bukkit.event.world.TimeSkipEvent;
|
||||
|
||||
public class BloodmoonTimeSkipListener extends ApplianceListener<Bloodmoon> {
|
||||
@EventHandler
|
||||
public void onTimeSkip(TimeSkipEvent event) {
|
||||
if(this.getAppliance().bloodmoonSkippable || !event.getSkipReason().equals(TimeSkipEvent.SkipReason.NIGHT_SKIP)) {
|
||||
this.getAppliance().stopBloodmoonIfInactive();
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerSleep(PlayerBedEnterEvent event) {
|
||||
if(!this.getAppliance().bloodmoonIsActive()) return;
|
||||
if(this.getAppliance().bloodmoonSkippable) return;
|
||||
if(!event.getBedEnterResult().equals(PlayerBedEnterEvent.BedEnterResult.OK)) return;
|
||||
event.setUseBed(Event.Result.DENY);
|
||||
event.getPlayer().sendActionBar(Component.text("Du kannst während dem Blutmond nicht schlafen"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package eu.mhsl.craftattack.spawn.craftattack.appliances.gameplay.portableCrafting;
|
||||
|
||||
import eu.mhsl.craftattack.spawn.common.appliances.metaGameplay.settings.Settings;
|
||||
import eu.mhsl.craftattack.spawn.core.appliance.ApplianceListener;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
class OnCraftingBlockUseListener extends ApplianceListener<PortableCrafting> {
|
||||
@EventHandler
|
||||
public void inInteract(PlayerInteractEvent event) {
|
||||
if(!event.getAction().equals(Action.RIGHT_CLICK_AIR)) return;
|
||||
if(!Settings.instance().getSetting(event.getPlayer(), Settings.Key.EnablePortableCrafting, Boolean.class)) return;
|
||||
|
||||
switch(event.getMaterial()) {
|
||||
case CRAFTING_TABLE -> this.getAppliance().openCraftingTable(event.getPlayer());
|
||||
case STONECUTTER -> this.getAppliance().openStonecutter(event.getPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package eu.mhsl.craftattack.spawn.craftattack.appliances.gameplay.portableCrafting;
|
||||
|
||||
import eu.mhsl.craftattack.spawn.core.appliance.ApplianceListener;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
class OnCraftingTableUseListener extends ApplianceListener<PortableCrafting> {
|
||||
@EventHandler
|
||||
public void inInteract(PlayerInteractEvent event) {
|
||||
if(!event.getAction().equals(Action.RIGHT_CLICK_AIR)) return;
|
||||
if(!event.getMaterial().equals(Material.CRAFTING_TABLE)) return;
|
||||
this.getAppliance().openFor(event.getPlayer());
|
||||
}
|
||||
}
|
||||
@@ -14,13 +14,16 @@ public class PortableCrafting extends Appliance {
|
||||
Settings.instance().declareSetting(PortableCraftingSetting.class);
|
||||
}
|
||||
|
||||
public void openFor(Player player) {
|
||||
if(!Settings.instance().getSetting(player, Settings.Key.EnablePortableCrafting, Boolean.class)) return;
|
||||
public void openCraftingTable(Player player) {
|
||||
player.openWorkbench(null, true);
|
||||
}
|
||||
|
||||
public void openStonecutter(Player player) {
|
||||
player.openStonecutter(null, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<Listener> listeners() {
|
||||
return List.of(new OnCraftingTableUseListener());
|
||||
return List.of(new OnCraftingBlockUseListener());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public class PortableCraftingSetting extends BoolSetting implements CategorizedS
|
||||
|
||||
@Override
|
||||
protected String description() {
|
||||
return "Erlaubt das öffnen einer Werkbank in der Hand, ohne sie plazieren zu müssen";
|
||||
return "Erlaubt das öffnen einer Werkbank oder einer Steinsäge in der Hand, ohne den Block plazieren zu müssen";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -160,6 +160,7 @@ public class Event extends Appliance {
|
||||
p.sendMessage(Component.text("Betrete...", NamedTextColor.GREEN));
|
||||
PluginMessage.connect(p, this.localConfig().getString("connect-server-name"));
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
PluginMessage.connect(p, "grand-event");
|
||||
|
||||
@@ -9,7 +9,6 @@ import eu.mhsl.craftattack.spawn.core.api.HttpStatus;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.ComponentBuilder;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.event.HoverEvent;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -52,7 +51,7 @@ public class Feedback extends Appliance {
|
||||
|
||||
message
|
||||
.append(Component.text("Klicke hier und gib uns Feedback, damit wir dein Spielerlebnis verbessern können!", NamedTextColor.DARK_GREEN)
|
||||
.hoverEvent(HoverEvent.showText(ComponentUtil.clickLink(feedbackUrl))))
|
||||
.append(ComponentUtil.clickLink(feedbackUrl)))
|
||||
.appendNewline()
|
||||
.append(border);
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Appliance.Flags(autoload = false, enabled = false)
|
||||
public class WorldMuseum extends Appliance {
|
||||
public DisplayVillager.ConfigBound villager;
|
||||
|
||||
|
||||
@@ -20,9 +20,10 @@ public class Strikes extends Appliance {
|
||||
|
||||
private final Map<Integer, Duration> strikePunishmentMap = Map.of(
|
||||
1, Duration.ofHours(1),
|
||||
2, Duration.ofHours(24),
|
||||
3, Duration.ofDays(3),
|
||||
4, Duration.ofDays(7)
|
||||
2, Duration.ofHours(3),
|
||||
3, Duration.ofDays(1),
|
||||
4, Duration.ofDays(2),
|
||||
5, Duration.ofDays(3)
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class Whitelist extends Appliance {
|
||||
? Floodgate.getBedrockPlayer(player).getUsername()
|
||||
: player.getName();
|
||||
|
||||
if(!user.username().trim().equalsIgnoreCase(purePlayerName))
|
||||
if(!user.username().trim().equalsIgnoreCase(purePlayerName) && !Floodgate.isBedrock(player)) // TODO: Bedrock Namen mit leerzeichen funktionieren nicht, daher die ausnahme bei der NUtzernamenprüfung
|
||||
throw new DisconnectInfo.Throwable(
|
||||
"Nutzername geändert",
|
||||
String.format("Der Name '%s' stimmt nicht mit '%s' überein.", user.username(), player.getName()),
|
||||
|
||||
@@ -12,6 +12,6 @@ class InfectionSpawnListener extends ApplianceListener<ArmadilloInfectionReducer
|
||||
public void onSpawn(CreatureSpawnEvent event) {
|
||||
if(!event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.POTION_EFFECT)) return;
|
||||
if(!event.getEntity().getType().equals(EntityType.SILVERFISH)) return;
|
||||
if(ThreadLocalRandom.current().nextDouble() > 0.7) event.setCancelled(true);
|
||||
if(ThreadLocalRandom.current().nextDouble() > 0.8) event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package eu.mhsl.craftattack.spawn.craftattack.appliances.tweaks.silverfishExpReducer;
|
||||
|
||||
import eu.mhsl.craftattack.spawn.core.appliance.Appliance;
|
||||
import eu.mhsl.craftattack.spawn.core.appliance.ApplianceListener;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
|
||||
@Appliance.Flags(enabled = false)
|
||||
class SilverfishDeathListener extends ApplianceListener<SilverfishExpReducer> {
|
||||
@EventHandler
|
||||
public void onDeath(EntityDeathEvent event) {
|
||||
|
||||
Reference in New Issue
Block a user