-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix : #17 Fix : #18 Fix : Les commandes admins ne fonctionnait pas quand j'ai mis à jour le code Fix : Je m'étais trompé de fichier pour le setsize et setmaxmembers pour le admin Fix : La WorldBorder ne se mettait pas à jour quand on changeait la taille de l'ile Fix : La suppression de l'ile s'arrêter sur avant la suppression total, c'est fixé et prends la taille de l'ile Add : Ajout de l'API SkyblockChangeSizeEvent Add : le /skyllia visit supporte maintenant les UUID Version 1.0-RC2
- Loading branch information
Showing
27 changed files
with
319 additions
and
197 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
api/src/main/java/fr/euphyllia/skyllia/api/event/SkyblockChangeSizeEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package fr.euphyllia.skyllia.api.event; | ||
|
||
import fr.euphyllia.skyllia.api.skyblock.Island; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.HandlerList; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class SkyblockChangeSizeEvent extends Event { | ||
|
||
|
||
private static final HandlerList handlerList = new HandlerList(); | ||
private final Island island; | ||
private final double sizeIsland; | ||
|
||
public SkyblockChangeSizeEvent(Island island, double rayon) { | ||
super(true); | ||
this.island = island; | ||
this.sizeIsland = rayon; | ||
} | ||
|
||
|
||
public static HandlerList getHandlerList() { | ||
return handlerList; | ||
} | ||
|
||
@Override | ||
public @NotNull HandlerList getHandlers() { | ||
return getHandlerList(); | ||
} | ||
|
||
public Island getIsland() { | ||
return this.island; | ||
} | ||
|
||
public double getSizeIsland() { | ||
return this.sizeIsland; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 0 additions & 22 deletions
22
plugin/src/main/java/fr/euphyllia/skyllia/commands/admin/subcommands/InfoSubCommands.java
This file was deleted.
Oops, something went wrong.
92 changes: 92 additions & 0 deletions
92
...c/main/java/fr/euphyllia/skyllia/commands/admin/subcommands/SetMaxMembersSubCommands.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package fr.euphyllia.skyllia.commands.admin.subcommands; | ||
|
||
import fr.euphyllia.skyllia.Main; | ||
import fr.euphyllia.skyllia.api.skyblock.Island; | ||
import fr.euphyllia.skyllia.commands.SubCommandInterface; | ||
import fr.euphyllia.skyllia.configuration.LanguageToml; | ||
import fr.euphyllia.skyllia.managers.skyblock.SkyblockManager; | ||
import org.apache.logging.log4j.Level; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.List; | ||
import java.util.UUID; | ||
import java.util.concurrent.Executors; | ||
import java.util.concurrent.ScheduledExecutorService; | ||
|
||
public class SetMaxMembersSubCommands implements SubCommandInterface { | ||
|
||
private final Logger logger = LogManager.getLogger(SetMaxMembersSubCommands.class); | ||
|
||
@Override | ||
public boolean onCommand(@NotNull Main plugin, @NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { | ||
if (!(sender instanceof Player player)) { | ||
return true; | ||
} | ||
if (!player.hasPermission("skyllia.admins.commands.island.setmaxmembers")) { | ||
LanguageToml.sendMessage(plugin, player, LanguageToml.messagePlayerPermissionDenied); | ||
return true; | ||
} | ||
|
||
if (args.length < 3) { | ||
LanguageToml.sendMessage(plugin, player, LanguageToml.messageASetMaxMembersCommandNotEnoughArgs); | ||
return true; | ||
} | ||
String playerName = args[0]; | ||
String changeValue = args[1]; | ||
String confirm = args[2]; | ||
if (!confirm.equalsIgnoreCase("confirm")) { | ||
LanguageToml.sendMessage(plugin, player, LanguageToml.messageASetMaxMembersNotConfirmedArgs); | ||
return true; | ||
} | ||
ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); | ||
try { | ||
executor.execute(() -> { | ||
try { | ||
UUID playerId; | ||
try { | ||
playerId = UUID.fromString(playerName); | ||
} catch (IllegalArgumentException ignored) { | ||
playerId = Bukkit.getPlayerUniqueId(playerName); | ||
} | ||
SkyblockManager skyblockManager = plugin.getInterneAPI().getSkyblockManager(); | ||
Island island = skyblockManager.getIslandByOwner(playerId).join(); | ||
if (island == null) { | ||
LanguageToml.sendMessage(plugin, player, LanguageToml.messagePlayerHasNotIsland); | ||
return; | ||
} | ||
|
||
int members = Integer.parseInt(changeValue); | ||
boolean updated = island.setMaxMembers(members); | ||
if (updated) { | ||
LanguageToml.sendMessage(plugin, player, LanguageToml.messageASetSizeSuccess); | ||
} else { | ||
LanguageToml.sendMessage(plugin, player, LanguageToml.messageASetSizeFailed); | ||
} | ||
|
||
} catch (Exception e) { | ||
if (e instanceof NumberFormatException ignored) { | ||
LanguageToml.sendMessage(plugin, player, LanguageToml.messageASetMaxMembersNAN); | ||
} else { | ||
logger.log(Level.FATAL, e.getMessage(), e); | ||
LanguageToml.sendMessage(plugin, player, LanguageToml.messageError); | ||
} | ||
} | ||
}); | ||
} finally { | ||
executor.shutdown(); | ||
} | ||
return true; | ||
} | ||
|
||
@Override | ||
public @Nullable List<String> onTabComplete(@NotNull Main plugin, @NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.