improved sleeping + added ignore sleep vote command
Some checks failed
Gitea Actions Demo / Build-Gradle (push) Failing after 1m38s

This commit is contained in:
Your Name
2025-07-02 13:22:11 +02:00
parent c93bc1f7c2
commit daeabb6c4f
114 changed files with 227 additions and 65 deletions

View File

@@ -1,9 +1,16 @@
gradle wrapper
./gradlew clean build
Open the Command Palette: Cmd+Shift+P
• Developer: reload window
ALLGEMEIN: recipes die custom items beinhalten werden nicht im crafting angezeigt (allgm. Bukkit problem) ALLGEMEIN: recipes die custom items beinhalten werden nicht im crafting angezeigt (allgm. Bukkit problem)
INFO: CustomItemIcon count: 22 INFO: CustomItemIcon count: 22
BUG: Autocrafter nicht von seite möglich BUG: Autocrafter nicht von seite möglich
BUG: Music Disc 13 now unfunctional (vertrtbar) BUG: Music Disc 13 now unfunctional (vertrtbar)
IDEA: schere verschiedene versionen pferde/mule/cats/schafe/Axolotl/tropical etc? IDEA: schere verschiedene versionen pferde/mule/cats/schafe/Axolotl/tropical etc?
TO RELEASE: ignorevote command
TO RELEASE: waterbottle + sponge = empty bottle -> Warum nochmal? TO RELEASE: waterbottle + sponge = empty bottle -> Warum nochmal?
TO RELEASE: Autocrafter TO RELEASE: Autocrafter
TO RELEASE: jukeboxes können mit Redstone gesteuert werden + crafted music TO RELEASE: jukeboxes können mit Redstone gesteuert werden + crafted music

Binary file not shown.

View File

@@ -1,2 +1,2 @@
#Mon Mar 10 20:23:21 CET 2025 #Sun Jun 29 18:53:26 CEST 2025
gradle.version=8.13 gradle.version=8.14.2

View File

@@ -1,2 +1,2 @@
Command: /opt/homebrew/Cellar/openjdk/23.0.2/libexec/openjdk.jdk/Contents/Home/bin/java -Xmx1G -classpath /Users/janik/.gradle/caches/modules-2/files-2.1/net.fabricmc/tiny-remapper/0.10.4/d78e8e115ba5ac99421ce2d5e84e88b91a5f08b7/tiny-remapper-0.10.4-fat.jar net.fabricmc.tinyremapper.Main /Users/janik/Desktop/MCPlugins/environmentex-1.0-SNAPSHOT.jar /Users/janik/Desktop/MCPlugins/environmentex/build/libs/environmentex-1.0-SNAPSHOT-reobf.jar /Users/janik/Desktop/MCPlugins/environmentex/.gradle/caches/paperweight/taskCache/reobfMappings.tiny mojang spigot /Users/janik/Desktop/MCPlugins/environmentex/.gradle/caches/paperweight/taskCache/mappedServerJar.jar --threads=1 Command: /opt/homebrew/Cellar/openjdk/23.0.2/libexec/openjdk.jdk/Contents/Home/bin/java -Xmx1G -classpath /Users/janik/.gradle/caches/modules-2/files-2.1/net.fabricmc/tiny-remapper/0.11.1/6c1f29838864ba8f495855edfc8ef17706fedb5d/tiny-remapper-0.11.1-fat.jar net.fabricmc.tinyremapper.Main /Users/janik/Desktop/MCPlugins/environmentex-1.0-SNAPSHOT.jar /Users/janik/Desktop/MCPlugins/environmentex/build/libs/environmentex-1.0-SNAPSHOT-reobf.jar /Users/janik/Desktop/MCPlugins/environmentex/.gradle/caches/paperweight/taskCache/reobfMappings.tiny mojang spigot /Users/janik/Desktop/MCPlugins/environmentex/.gradle/caches/paperweight/taskCache/mappedServerJar.jar --threads=1
Finished after 827,23 ms. [INFO] Finished after 3356,66 ms.

View File

@@ -1,4 +1,3 @@
{ {
"java.compile.nullAnalysis.mode": "automatic", "java.compile.nullAnalysis.mode": "automatic"
"java.configuration.updateBuildConfiguration": "interactive"
} }

View File

@@ -1,24 +0,0 @@
main: de.hessj.environmentex.App
name: EnvironmentExtenderPlugin
version: 0.1
api-version: 1.19
depend: [HelperPlugin]
commands:
test:
description: Vote mit "Ja" für den Nachtskip
usage: /<command>
y:
description: Vote mit "Ja" für den Nachtskip
usage: /<command>
n:
description: Vote mit "Nein" für den Nachtskip
usage: /<command>
add:
description: Setzt den Whiteliststatus auf accepted
usage: /<command> <UUID>
afk:
description: Setzt den AFK Status
usage: /<command>
pin:
description: ----
usage: /<command>

View File

@@ -1,6 +1,6 @@
plugins { plugins {
`java-library` `java-library`
id("io.papermc.paperweight.userdev") version "2.0.0-beta.14" id("io.papermc.paperweight.userdev") version "2.0.0-beta.17"
id("xyz.jpenilla.run-paper") version "2.3.1" // Adds runServer and runMojangMappedServer tasks for testing id("xyz.jpenilla.run-paper") version "2.3.1" // Adds runServer and runMojangMappedServer tasks for testing
} }
group = "de.hessj.environmentex" group = "de.hessj.environmentex"
@@ -33,6 +33,13 @@ tasks {
javadoc { javadoc {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
} }
java {
sourceSets {
named("main") {
java.srcDir("src/main/java")
}
}
}
processResources { processResources {
filteringCharset = Charsets.UTF_8.name() // We want UTF-8 for everything filteringCharset = Charsets.UTF_8.name() // We want UTF-8 for everything
val props = mapOf( val props = mapOf(

File diff suppressed because one or more lines are too long

View File

@@ -21,4 +21,7 @@ commands:
usage: /<command> usage: /<command>
pin: pin:
description: ---- description: ----
usage: /<command>
ignorevote:
description: Setzt den Ignorevote Status
usage: /<command> usage: /<command>

Binary file not shown.

View File

@@ -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-8.13-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

View File

@@ -114,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;; NONSTOP* ) nonstop=true ;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
@@ -213,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \ -classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@" "$@"
# Stop when "xargs" is not available. # Stop when "xargs" is not available.

View File

@@ -70,11 +70,11 @@ goto fail
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set CLASSPATH=
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell

View File

@@ -6,6 +6,8 @@ import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import org.bukkit.NamespacedKey; import org.bukkit.NamespacedKey;
@@ -13,7 +15,9 @@ import org.bukkit.World;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Recipe; import org.bukkit.inventory.Recipe;
@@ -59,6 +63,9 @@ public class App extends JavaPlugin {
public File tpYml = new File(this.getDataFolder() + "/texturepack.yml"); public File tpYml = new File(this.getDataFolder() + "/texturepack.yml");
public FileConfiguration tpConfig = YamlConfiguration.loadConfiguration(tpYml); public FileConfiguration tpConfig = YamlConfiguration.loadConfiguration(tpYml);
@Override @Override
public void onEnable() { public void onEnable() {
tpConfig.addDefault("url", "https://mc.hessj.de/texturepack/CUSTOM.zip"); tpConfig.addDefault("url", "https://mc.hessj.de/texturepack/CUSTOM.zip");
@@ -431,7 +438,6 @@ public class App extends JavaPlugin {
} }
private void listenerRegistration() { private void listenerRegistration() {
pM.registerEvents(new LoginListener(), this); pM.registerEvents(new LoginListener(), this);
pM.registerEvents(new EnvironmentExListeners(), this); pM.registerEvents(new EnvironmentExListeners(), this);
pM.registerEvents(new InvisibleFrame(), this); pM.registerEvents(new InvisibleFrame(), this);
@@ -453,6 +459,7 @@ public class App extends JavaPlugin {
pM.registerEvents(new ShulkerPreview(), this); pM.registerEvents(new ShulkerPreview(), this);
pM.registerEvents(new BetterTotems(), this); pM.registerEvents(new BetterTotems(), this);
pM.registerEvents(new CustomMusicDiscs(), this); pM.registerEvents(new CustomMusicDiscs(), this);
pM.registerEvents(new PinFeature(), this);
getCommand("test").setExecutor(new EnvironmentExCommands()); getCommand("test").setExecutor(new EnvironmentExCommands());
getCommand("y").setExecutor(new EnvironmentExCommands()); getCommand("y").setExecutor(new EnvironmentExCommands());
getCommand("n").setExecutor(new EnvironmentExCommands()); getCommand("n").setExecutor(new EnvironmentExCommands());
@@ -460,6 +467,7 @@ public class App extends JavaPlugin {
getCommand("afk").setExecutor(new EnvironmentExCommands()); getCommand("afk").setExecutor(new EnvironmentExCommands());
getCommand("pin").setExecutor(new EnvironmentExCommands()); getCommand("pin").setExecutor(new EnvironmentExCommands());
getCommand("pin").setTabCompleter(new PinFeature()); getCommand("pin").setTabCompleter(new PinFeature());
getCommand("ignorevote").setExecutor(new EnvironmentExCommands());
} }
public void log(Object msg) { public void log(Object msg) {

View File

@@ -17,6 +17,7 @@ import org.bukkit.inventory.meta.Damageable;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
public class CustomItems implements Listener { public class CustomItems implements Listener {
public static ItemStack flintBlock = new ItemStack(Material.DIRT); public static ItemStack flintBlock = new ItemStack(Material.DIRT);

View File

@@ -1,5 +1,6 @@
package de.hessj.environmentex; package de.hessj.environmentex;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
@@ -18,18 +19,23 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import de.hessj.helper.Helper.Type; import de.hessj.helper.Helper.Type;
import org.bukkit.scheduler.BukkitTask;
public class EnvironmentExCommands implements CommandExecutor, Listener { public class EnvironmentExCommands implements CommandExecutor, Listener {
public de.hessj.helper.Helper helper = new de.hessj.helper.Helper(); public de.hessj.helper.Helper helper = new de.hessj.helper.Helper();
private final Map<UUID, Map<String, Location>> playerPins = new HashMap<>(); private final Map<UUID, Map<String, Location>> playerPins = new HashMap<>();
private HashMap<UUID, BossBar> bossBars = new HashMap<>(); public static final Map<UUID, BukkitTask> playerTasks = new HashMap<>();
public static HashMap<UUID, BossBar> bossBars = new HashMap<>();
int taskId;
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) { if (sender instanceof Player) {
@@ -54,6 +60,33 @@ public class EnvironmentExCommands implements CommandExecutor, Listener {
p.playerListName(App.helper.R3SMessage(Type.ERROR, "[AFK] " + p.getName())); p.playerListName(App.helper.R3SMessage(Type.ERROR, "[AFK] " + p.getName()));
} }
if (label.equalsIgnoreCase("ignorevote")) {
if(args.length != 1){
return false;
}
Player p = (Player) sender;
if(!args[0].equalsIgnoreCase("false") && !args[0].equalsIgnoreCase("true")) {
p.sendMessage(helper.R3SMessage(Type.ERROR,
"Benutzung: /ignorevote <true | false>"));
return true;
}
LoginListener.customConfig.set("players." + p.getUniqueId() + ".ignorevote", Boolean.parseBoolean(args[0]));
LoginListener.saveCustomYml(LoginListener.customConfig, LoginListener.customYml);
}
if (label.equalsIgnoreCase("pin")) { if (label.equalsIgnoreCase("pin")) {
Player p = (Player) sender; Player p = (Player) sender;
UUID playerId = p.getUniqueId(); UUID playerId = p.getUniqueId();
@@ -61,7 +94,7 @@ public class EnvironmentExCommands implements CommandExecutor, Listener {
if (args.length < 1) { if (args.length < 1) {
p.sendMessage(helper.R3SMessage(Type.ERROR, p.sendMessage(helper.R3SMessage(Type.ERROR,
"Benutzung: /pin <set | list | remove | follow | unfollow> [name | id]")); "Benutzung: /pin <set | list | remove | follow | unfollow> [name | id] | send [id | onlineplayer]"));
return true; return true;
} }
@@ -69,6 +102,13 @@ public class EnvironmentExCommands implements CommandExecutor, Listener {
Map<String, Location> pins = playerPins.get(playerId); Map<String, Location> pins = playerPins.get(playerId);
switch (subCommand) { switch (subCommand) {
case "send":
if (args.length < 3) {
p.sendMessage(helper.R3SMessage(Type.ERROR, "Benutzung: /pin send <id> <onlineplayer>"));
return true;
}
break;
case "set": case "set":
if (args.length < 2) { if (args.length < 2) {
p.sendMessage(helper.R3SMessage(Type.ERROR, "Benutzung: /pin set <name>")); p.sendMessage(helper.R3SMessage(Type.ERROR, "Benutzung: /pin set <name>"));
@@ -172,6 +212,13 @@ public class EnvironmentExCommands implements CommandExecutor, Listener {
} }
try { try {
int pinId1 = Integer.parseInt(args[1]); int pinId1 = Integer.parseInt(args[1]);
String pinName1 = PinFeature.pinConfig.getString(playerId + "." + pinId1 + ".name"); String pinName1 = PinFeature.pinConfig.getString(playerId + "." + pinId1 + ".name");
String locationString1 = PinFeature.pinConfig.getString(playerId + "." + pinId1 + ".loc"); String locationString1 = PinFeature.pinConfig.getString(playerId + "." + pinId1 + ".loc");
@@ -188,14 +235,28 @@ public class EnvironmentExCommands implements CommandExecutor, Listener {
int y = Integer.parseInt(locParts[2]); int y = Integer.parseInt(locParts[2]);
int z = Integer.parseInt(locParts[3]); int z = Integer.parseInt(locParts[3]);
String worldLabel = "Overworld"; if(!p.getLocation().getWorld().getName().toString().equals(worldName.toString())) {
if (worldName.endsWith("_nether")) p.sendMessage(helper.R3SMessage(Type.ERROR, "Du kannst nur Pins aus deiner aktuellen Welt folgen."));
worldLabel = "Nether"; return true;
if (worldName.endsWith("_end")) }
worldLabel = "End";
p.sendMessage(helper.R3SMessage(Type.SUCCESS, "Du folgst nun dem Pin '" + pinName1 + "'"));
UUID uuid = p.getUniqueId();
if (playerTasks.containsKey(uuid)) {
BukkitTask existingTask = playerTasks.remove(uuid); // remove from map
existingTask.cancel(); // cancel the repeating task
}
BukkitTask task = Bukkit.getScheduler().runTaskTimer(App.main, () -> {
int cur_x = (int) p.getLocation().getBlockX();
int cur_y = (int) p.getLocation().getBlockY();
int cur_z = (int) p.getLocation().getBlockZ();
// BossBar erstellen/aktualisieren // BossBar erstellen/aktualisieren
BossBar bossBar = Bukkit.createBossBar(worldLabel + ": " + x + ", " + y + ", " + z, BossBar bossBar = Bukkit.createBossBar("Entfernung: " + (cur_x-x) + ", " + (cur_y-y) + ", " + (cur_z-z),
BarColor.WHITE, BarStyle.SOLID); BarColor.WHITE, BarStyle.SOLID);
bossBar.setProgress(0.0); bossBar.setProgress(0.0);
@@ -206,7 +267,28 @@ public class EnvironmentExCommands implements CommandExecutor, Listener {
bossBar.addPlayer(p); bossBar.addPlayer(p);
bossBars.put(p.getUniqueId(), bossBar); bossBars.put(p.getUniqueId(), bossBar);
p.sendMessage(helper.R3SMessage(Type.SUCCESS, "Du folgst nun dem Pin '" + pinName1 + "'"));
}, 0L, 5L);
playerTasks.put(uuid, task);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
p.sendMessage(helper.R3SMessage(Type.ERROR, "Kein Pin mit dieser ID gefunden.")); p.sendMessage(helper.R3SMessage(Type.ERROR, "Kein Pin mit dieser ID gefunden."));
@@ -217,7 +299,13 @@ public class EnvironmentExCommands implements CommandExecutor, Listener {
if (bossBars.containsKey(p.getUniqueId())) { if (bossBars.containsKey(p.getUniqueId())) {
bossBars.get(p.getUniqueId()).removeAll(); bossBars.get(p.getUniqueId()).removeAll();
bossBars.remove(p.getUniqueId()); bossBars.remove(p.getUniqueId());
p.sendMessage(helper.R3SMessage(Type.ERROR, "Du folgst nun keinem Pin mehr.")); UUID uuid = p.getUniqueId();
BukkitTask task = playerTasks.remove(uuid);
if (task != null) {
task.cancel();
p.sendMessage(helper.R3SMessage(Type.ERROR, "Du folgst nun keinem Pin mehr."));
}
} }
break; break;

View File

@@ -1,5 +1,6 @@
package de.hessj.environmentex; package de.hessj.environmentex;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@@ -24,6 +25,8 @@ import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.Fence; import org.bukkit.block.data.type.Fence;
import org.bukkit.block.data.type.Leaves; import org.bukkit.block.data.type.Leaves;
import org.bukkit.block.data.type.Stairs; import org.bukkit.block.data.type.Stairs;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Axolotl; import org.bukkit.entity.Axolotl;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Fish; import org.bukkit.entity.Fish;
@@ -69,10 +72,9 @@ public class EnvironmentExListeners implements Listener {
public static boolean voteIsGoing = false; public static boolean voteIsGoing = false;
public static int voteForYes; public static int voteForYes;
public static int voteForNo; public static int voteForNo;
public static int onlinePlayers; public static int voteablePlayers;
public static ArrayList<UUID> hasVoted = new ArrayList<UUID>(); public static ArrayList<UUID> hasVoted = new ArrayList<UUID>();
public static Location lastLoc; public static Location lastLoc;
public de.hessj.helper.Helper helper = new de.hessj.helper.Helper(); public de.hessj.helper.Helper helper = new de.hessj.helper.Helper();
boolean isAlone() { boolean isAlone() {
@@ -116,10 +118,28 @@ public class EnvironmentExListeners implements Listener {
voteIsGoing = true; voteIsGoing = true;
voteForYes = 1; voteForYes = 1;
voteForNo = 0; voteForNo = 0;
onlinePlayers = 0; voteablePlayers = 0;
hasVoted.add(e.getPlayer().getUniqueId()); hasVoted.add(e.getPlayer().getUniqueId());
for (Player p : App.main.getServer().getOnlinePlayers()) { for (Player p : App.main.getServer().getOnlinePlayers()) {
onlinePlayers++;
if(p.playerListName().toString().contains("[AFK] ")){
//skipping because AFK
continue;
}
//wenn player AFK auch!
if(p.getUniqueId().equals(e.getPlayer().getUniqueId())){
//skipping because sleeper
continue;
}
if(LoginListener.customConfig.getBoolean("players." + p.getUniqueId() + ".ignorevote")){
//skipping because ignorevote
continue;
}
voteablePlayers++;
if (e.getBed().getWorld().isThundering()) { if (e.getBed().getWorld().isThundering()) {
p.sendMessage(helper.R3SMessage(Type.INFO, e.getPlayer().getName() p.sendMessage(helper.R3SMessage(Type.INFO, e.getPlayer().getName()
@@ -134,6 +154,20 @@ public class EnvironmentExListeners implements Listener {
p.sendMessage(helper.R3SMessage(Type.INFO, "Du hast ab jetzt 10 Sekunden Zeit.")); p.sendMessage(helper.R3SMessage(Type.INFO, "Du hast ab jetzt 10 Sekunden Zeit."));
} }
if(voteablePlayers == 0){
if (e.getBed().getWorld().isThundering()) {
Bukkit.getWorlds().get(0).setTime(24000);
Bukkit.getWorlds().get(0).setStorm(false);
Bukkit.getWorlds().get(0).setThundering(false);
Bukkit.getWorlds().get(0).setWeatherDuration(6000);
} else {
Bukkit.getWorlds().get(0).setTime(24000);
}
voteIsGoing = false;
return;
}
Bukkit.getScheduler().scheduleSyncDelayedTask(App.main, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(App.main, new Runnable() {
public void run() { public void run() {
voteIsGoing = false; voteIsGoing = false;
@@ -145,7 +179,7 @@ public class EnvironmentExListeners implements Listener {
p.sendMessage(helper.R3SMessage(Type.OK, "Das Gewitter wird durchgeschlafen. (" p.sendMessage(helper.R3SMessage(Type.OK, "Das Gewitter wird durchgeschlafen. ("
+ voteForYes + "x Ja, " + voteForNo + "x Nein, " + voteForYes + "x Ja, " + voteForNo + "x Nein, "
+ (onlinePlayers - voteForNo - voteForYes) + "x enthalten)")); + (voteablePlayers - voteForNo - voteForYes) + "x enthalten)"));
} }
@@ -153,7 +187,7 @@ public class EnvironmentExListeners implements Listener {
p.sendMessage(helper.R3SMessage(Type.OK, "Die Nacht wird durchgeschlafen. (" p.sendMessage(helper.R3SMessage(Type.OK, "Die Nacht wird durchgeschlafen. ("
+ voteForYes + "x Ja, " + voteForNo + "x Nein, " + voteForYes + "x Ja, " + voteForNo + "x Nein, "
+ (onlinePlayers - voteForNo - voteForYes) + "x enthalten)")); + (voteablePlayers - voteForNo - voteForYes) + "x enthalten)"));
} }
} }
@@ -175,14 +209,14 @@ public class EnvironmentExListeners implements Listener {
p.sendMessage(helper.R3SMessage(Type.ERROR, p.sendMessage(helper.R3SMessage(Type.ERROR,
"Das Gewitter wird nicht durchgeschlafen. (" + voteForYes + "x Ja, " "Das Gewitter wird nicht durchgeschlafen. (" + voteForYes + "x Ja, "
+ voteForNo + voteForNo
+ "x Nein, " + (onlinePlayers - voteForNo - voteForYes) + "x Nein, " + (voteablePlayers - voteForNo - voteForYes)
+ "x enthalten)")); + "x enthalten)"));
} else { } else {
p.sendMessage(helper.R3SMessage(Type.ERROR, p.sendMessage(helper.R3SMessage(Type.ERROR,
"Die Nacht wird nicht durchgeschlafen. (" + voteForYes + "x Ja, " "Die Nacht wird nicht durchgeschlafen. (" + voteForYes + "x Ja, "
+ voteForNo + voteForNo
+ "x Nein, " + (onlinePlayers - voteForNo - voteForYes) + "x Nein, " + (voteablePlayers - voteForNo - voteForYes)
+ "x enthalten)")); + "x enthalten)"));
} }
if (p.isSleeping()) { if (p.isSleeping()) {

View File

@@ -11,7 +11,6 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import de.hessj.helper.Helper.Type; import de.hessj.helper.Helper.Type;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.title.Title; import net.kyori.adventure.title.Title;
@@ -36,6 +35,7 @@ public class LoginListener implements Listener {
(DateTimeFormatter.ofPattern("dd.MM.YYYY-HH:mm:ss")).format(LocalDateTime.now())); (DateTimeFormatter.ofPattern("dd.MM.YYYY-HH:mm:ss")).format(LocalDateTime.now()));
customConfig.set("players." + e.getPlayer().getUniqueId() + ".whitelisted", false); customConfig.set("players." + e.getPlayer().getUniqueId() + ".whitelisted", false);
customConfig.set("players." + e.getPlayer().getUniqueId() + ".hasSeenTutorial", false); customConfig.set("players." + e.getPlayer().getUniqueId() + ".hasSeenTutorial", false);
customConfig.set("players." + e.getPlayer().getUniqueId() + ".ignorevote", false);
saveCustomYml(customConfig, customYml); saveCustomYml(customConfig, customYml);
} }
if (customConfig.getBoolean("players." + e.getPlayer().getUniqueId() + ".whitelisted")) { if (customConfig.getBoolean("players." + e.getPlayer().getUniqueId() + ".whitelisted")) {
@@ -60,6 +60,7 @@ public class LoginListener implements Listener {
public static void saveCustomYml(FileConfiguration ymlConfig, File ymlFile) { public static void saveCustomYml(FileConfiguration ymlConfig, File ymlFile) {
try { try {
ymlConfig.save(ymlFile); ymlConfig.save(ymlFile);
YamlConfiguration.loadConfiguration(ymlFile);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }

Some files were not shown because too many files have changed in this diff Show More