Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All dev changes from GreenSurvivors #383

Merged
merged 116 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
44f9d2e
Fixing not visible tool-points
joshi1999 Jan 30, 2022
848223e
Fixing Loadout for Offhand
joshi1999 Mar 8, 2022
1663f14
Adding new 1.16 materials
joshi1999 Mar 8, 2022
c87ed8e
Merge pull request #1 from GreenSurvivors/dev
Schpammer Mar 8, 2022
9978137
MatchTeamColor Condidtion showing matching item to color
joshi1999 Mar 8, 2022
c32475a
Fixes PlayerHasItemCondition
joshi1999 Mar 8, 2022
da8b7ad
Fixing AsyncInventoryEvent Calls
joshi1999 Mar 9, 2022
f7dbe71
Adding GameTickTrigger
joshi1999 Mar 10, 2022
5630353
Fixing Region Select NoSuchElementError
joshi1999 Mar 10, 2022
89f039b
Adding keep inventory option
joshi1999 Jul 19, 2022
3f1b9f7
Update to 1.19
joshi1999 Aug 5, 2022
7b64d34
Update minigamesdistribution to 1.19
joshi1999 Aug 5, 2022
442a00e
Update Mavenworkflow to Java 17
joshi1999 Aug 5, 2022
fdb29ea
Adding potionFriendlyFire configuration
joshi1999 Sep 23, 2022
8705cbf
T::28 Correcting GUI information
joshi1999 Sep 27, 2022
49c4814
T::32,39,42 Translation strings missing
joshi1999 Oct 1, 2022
a7f0952
Added every possible vanilla potion effekt.
joshi1999 Oct 14, 2022
891bdb6
Fixes T::45, T::46, T::49, T::53
joshi1999 Oct 30, 2022
a41fc9b
Merge pull request #2 from GreenSurvivors/keepInv
joshi1999 Oct 30, 2022
f3aa5ff
Merge branch 'master' of github.com:GreenSurvivors/GreenMinigames int…
joshi1999 Nov 4, 2022
f87dd28
T::44 Support for signs
joshi1999 Mar 14, 2023
827968d
T::9 Autocomplete Commands: set node/region
joshi1999 Mar 20, 2023
92e3848
T::22 Wrong message when there's no lobby
joshi1999 Mar 20, 2023
c6afe45
T::18 Flag falling in lava does not respawn
joshi1999 Mar 22, 2023
19ae085
Replaced deprecated MinigameUtils.formStr call
joshi1999 Mar 23, 2023
39f3d81
Fixed reset of Blocks in Minigames. (#3)
FireInstall Apr 14, 2023
3279507
Rebuilt how the regeneration region works (#4)
FireInstall Apr 17, 2023
8592d4d
Rebuilt FloorDegeneration to use the new Regeneration Regions (#7)
FireInstall Apr 17, 2023
420accd
Code cleanup (#5)
FireInstall Apr 17, 2023
af2c6c8
Merging Memory and Region Actions from Turidus (#8)
FireInstall Apr 17, 2023
4e7e177
Fix MemorySwapBlock for unordered created regions
joshi1999 Apr 18, 2023
deb1728
Updating actions to use a cache for faster building (#10)
joshi1999 Apr 18, 2023
dbcb0af
fix regen regions and lists not getting saved
FireInstall Apr 18, 2023
4aabe44
fix regen regions not regenerating properly
FireInstall Apr 18, 2023
74b276f
added feedback how many blocks are in a regenregion total
FireInstall Apr 18, 2023
a3850c7
added a new trigger to fire whenever a player moves inside a region (…
FireInstall Apr 18, 2023
770cadb
fix binding to first item in inventory instead of in hands
FireInstall Apr 18, 2023
5d62c06
fix minigame objective error (rolling back the lines, still have to g…
FireInstall Apr 18, 2023
21d2076
fix false calculation, if one coord was 0
FireInstall Apr 18, 2023
d727d22
Merge pull request #11 from GreenSurvivors/devfeuer
joshi1999 Apr 18, 2023
4f91a98
Merge branch 'AddstarMC:master' into master
joshi1999 Jun 19, 2023
83d7a79
Fixing PullRequest Template
joshi1999 Jun 19, 2023
56e0690
Merge remote-tracking branch 'Addstar-upstream/master'
FireInstall Jul 14, 2023
bca29c7
Fixing hanging CTFFlags and min/max respawn heights
joshi1999 Jun 16, 2023
0c8d9d7
Adding new option to ctf: Teammates can now bring the flag back
joshi1999 Jun 17, 2023
f7f0684
fixing AddstarMC#360 : bets letting player join even if the betting f…
FireInstall Apr 18, 2023
df6f119
update dependencies, some dokumentation and code clean for turis code
FireInstall Apr 19, 2023
d3d1a78
added new blocks to MemorySwapBlockAction (the default list definitel…
FireInstall Apr 19, 2023
fb66b3e
fixing AddstarMC#247 : showing 0 as scores in case of a draw
FireInstall Apr 21, 2023
626a57a
Fixing Unlimited ammo multiplying it
FireInstall Apr 21, 2023
e390dc8
don't multiply bets as much
FireInstall Apr 21, 2023
6b7345c
remove unnecessary classes from jar
FireInstall Apr 21, 2023
aae9700
fix being able to break blocks regardless of black- / whitelist
FireInstall Apr 27, 2023
a2f196c
better MemorySwapBlockAction-blacklist
FireInstall Apr 27, 2023
e551aba
update deprecated BlockChanges
FireInstall Apr 27, 2023
f821d01
use tags instead of strings
FireInstall Apr 27, 2023
5bfc962
remove uses of stringToList
FireInstall Apr 28, 2023
e8444f1
MinigameUtils
FireInstall Apr 29, 2023
b7f9e23
fix create set regen command listening to tool
FireInstall Apr 29, 2023
b8dc3d0
T::59 SwapBlockAction is not affected by a BlockRecorder
joshi1999 Apr 18, 2023
1e7a04c
fixing AddstarMC#361 loadout config not properly loaded
joshi1999 Apr 18, 2023
2574abd
Wrong named Action "TIMED_TRIGGER" in Actions.java
joshi1999 Jun 24, 2023
f2ae2da
Devfeuer20 (#19)
FireInstall Jul 19, 2023
e262b37
use apache commons 3 WordUtils
FireInstall Jul 19, 2023
69ef4fb
Merge pull request #26 from GreenSurvivors/wordutils
FireInstall Jul 19, 2023
b21afe8
Added a list option for RegenRegions and added them to the nodes/regi…
FireInstall Jul 5, 2023
860cf72
Fix merge error
FireInstall Jul 24, 2023
b740f0c
fix api version
FireInstall Jul 24, 2023
a83ff71
Merge remote-tracking branch 'Addstar-upstream/master'
FireInstall Oct 13, 2023
74e660c
fix broken builds with newer maven versions
FireInstall Oct 25, 2023
166e500
exclude some newer jars from also getting distributed since there is …
FireInstall Oct 25, 2023
f3a23f4
possibly fix maven verify error of updated source plugin
FireInstall Oct 25, 2023
0445169
Merge pull request #27 from GreenSurvivors/buildline
FireInstall Dec 13, 2023
75c8ba3
Added GreenSurvivors as authors
FireInstall Jun 19, 2023
8a4f3df
update dependencies
FireInstall Jul 3, 2023
4362f40
Fix AddstarMc#269
FireInstall Jul 3, 2023
9a79fba
Fix AddstarMc#251
FireInstall Jul 3, 2023
55f1c7f
Fix Treasure out of bounds errors
FireInstall Jul 5, 2023
8460715
reactivate some menu items.
FireInstall Jul 7, 2023
351d87a
Fix AddstarMC#364
FireInstall Jul 9, 2023
e7e269f
Fix SCULK_CATALYST not being movable.
FireInstall Jul 13, 2023
9db8f6b
Fix error message
FireInstall Jul 13, 2023
bd7e3e9
Fix info messages missing a space
FireInstall Jul 13, 2023
2d8916c
Fix Whitelist not working because it's expecting always a material no…
FireInstall Jul 13, 2023
c39f92f
Lower if-else depth in TakeItemAction
joshi1999 Jul 19, 2023
a77c594
update MenuItemBlockData to show the material of the block
FireInstall Jul 24, 2023
4c8fd33
fix silent error if no start points for singleplayer where defined
FireInstall Jul 31, 2023
ca9458f
fix black/white list not blocking blocks to place
FireInstall Sep 17, 2023
38f4d0b
Fix TeamColors with two words failing in set start command
FireInstall Oct 10, 2023
244c90e
added a GameEnded trigger that fires whenever the minigame really has…
FireInstall Oct 24, 2023
6a8463e
some code health changes
FireInstall Oct 24, 2023
737a540
Fix NullPointerException in TimerCondition (was thrown if the game ha…
FireInstall Oct 25, 2023
65bf1bd
Fix wrong tool mode descriptions
FireInstall Oct 25, 2023
64cec22
(hopefully) fix using String menu items sometimes not working and wri…
FireInstall Dec 7, 2023
c552bf8
Fix Score commands still using red/blue teams
FireInstall Dec 12, 2023
a7f6274
Don't allow breaking of blocks CTF-flags are attached to
FireInstall Dec 12, 2023
8b3cf5c
Fix null error when quitting a Minigame with regen regions
FireInstall Dec 29, 2023
2f6b90c
Minigame spectators teleported using quit location if end location is…
FireInstall Dec 30, 2023
cf6abd1
fix hardcoded height limits for treasures
FireInstall Dec 30, 2023
64e094f
Fix timed remote trigger falsely claiming to not carry a player while…
FireInstall Jan 4, 2024
a6d1396
removed unused updateChecker setting
FireInstall Jan 6, 2024
b9ced8a
fix error setting start location (single player / first multiplayer)
FireInstall Jan 10, 2024
e21615f
fix langtag not getting detected correctly
FireInstall Jan 23, 2024
3833599
Fix language setting not getting used
FireInstall Jan 23, 2024
b8eb683
Fix builds broken if MockBukkit was not cached (aka github actions)
FireInstall Jan 23, 2024
bcd985a
Fix a possibility for double messages.
FireInstall Jan 24, 2024
e330743
Fix oversight allowing modification of menus
FireInstall Jan 24, 2024
96e4de7
requested changes
FireInstall Feb 23, 2024
0b8d6cd
Merge pull request #30 from GreenSurvivors/feuerFixes
FireInstall Feb 23, 2024
ce0a916
Adding recorder deactivation option
joshi1999 Dec 10, 2023
9e70022
Missing team match block color identifiers
joshi1999 Dec 11, 2023
5af69cd
Reimplement recorder deactivation
joshi1999 Feb 24, 2024
3422c0f
Rename ActivateBlockRecorder option to ActivatePlayerRecorder
joshi1999 Feb 25, 2024
5658362
Merge pull request #28 from GreenSurvivors/devjoshi
joshi1999 Feb 25, 2024
023e749
Merge dev changes from GreenSurvivors/GreenMinigames
addstar Mar 3, 2024
cf22602
Add some switch defaults to make Codacy happy
addstar Mar 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions Minigames/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<dependency>
<groupId>io.papermc</groupId>
<artifactId>paperlib</artifactId>
<version>1.0.5</version>
<version>1.0.7</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -132,6 +132,16 @@
<include>config.yml</include>
<include>*.properties</include>
<include>presets/*.yml</include>
</includes>
</resource>
<!-- With maven-resources-plugin(shipped with maven 3.9.0+
filtering binary / compressed data breaks since it assumes UTF-8.
We don't need filtering of it anyway.-->
<resource>
<targetPath>.</targetPath>
<filtering>false</filtering>
<directory>src/main/resources</directory>
<includes>
<include>resourcepack/*.zip</include>
</includes>
</resource>
Expand All @@ -152,7 +162,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.0</version>
<version>3.5.1</version>
<configuration>
<filters>
<filter>
Expand Down Expand Up @@ -200,7 +210,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -214,7 +224,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M6</version>
<version>3.2.1</version>
<configuration>
<skipTests>true</skipTests>
<forkCount>1</forkCount>
Expand All @@ -224,12 +234,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.5.0</version>
<version>3.6.1</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.8.1</version>
<version>2.16.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
65 changes: 48 additions & 17 deletions Minigames/src/main/java/au/com/mineauz/minigames/Events.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.player.*;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
Expand All @@ -48,7 +49,7 @@ public class Events implements Listener {
private final MinigameManager mdata = plugin.getMinigameManager();

@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerResourcePack(PlayerResourcePackStatusEvent event) {
public void onPlayerResourcePack(PlayerResourcePackStatusEvent event) { //todo 1.20.3 + add ressource pack not set
final MinigamePlayer ply = pdata.getMinigamePlayer(event.getPlayer());
List<MinigamePlayer> required = plugin.getPlayerManager().getApplyingPack();
if (ply.isInMinigame()) {
Expand Down Expand Up @@ -177,7 +178,7 @@ public void onPlayerDisconnect(PlayerQuitEvent event) {
MinigamePlayer ply = pdata.getMinigamePlayer(event.getPlayer());
if (ply.isInMinigame()) {
if (ply.getPlayer().isDead()) {
ply.getOfflineMinigamePlayer().setLoginLocation(ply.getMinigame().getQuitPosition());
ply.getOfflineMinigamePlayer().setLoginLocation(ply.getMinigame().getQuitLocation());
ply.getOfflineMinigamePlayer().savePlayerData();
}
pdata.quitMinigame(pdata.getMinigamePlayer(event.getPlayer()), false);
Expand Down Expand Up @@ -243,7 +244,7 @@ public void onPlayerConnect(PlayerJoinEvent event) {
}

@EventHandler
public void playerInterract(PlayerInteractEvent event) {
public void playerInteract(PlayerInteractEvent event) {
MinigamePlayer ply = pdata.getMinigamePlayer(event.getPlayer());

if (ply.isInMinigame() && !ply.canInteract()) {
Expand All @@ -252,11 +253,11 @@ public void playerInterract(PlayerInteractEvent event) {
}
if (ply.isInMenu() && ply.getNoClose() && ply.getManualEntry() != null) {
event.setCancelled(true);
ply.setNoClose(false);
if (event.getClickedBlock() != null) {
ply.setNoClose(false);
ply.getManualEntry().checkValidEntry(event.getClickedBlock().getBlockData().getAsString());
ply.setManualEntry(null);
}
ply.setManualEntry(null);
return;
}
if (event.getClickedBlock() != null && event.getClickedBlock().getType() == Material.DRAGON_EGG) {
Expand All @@ -271,6 +272,7 @@ public void playerInterract(PlayerInteractEvent event) {
if (cblock.getState() instanceof Sign sign && sign.getSide(Side.FRONT).getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE + "[Minigame]")) {
// wax signs automatically
sign.setWaxed(true);
sign.update();
if (event.getPlayer().hasPermission("minigame.sign.use.details")) {
if ((sign.getLine(1).equalsIgnoreCase(ChatColor.GREEN + "Join") || sign.getLine(1).equalsIgnoreCase(ChatColor.GREEN + "Bet")) && !ply.isInMinigame()) {
Minigame mgm = mdata.getMinigame(sign.getLine(2));
Expand Down Expand Up @@ -380,7 +382,6 @@ public void playerInterract(PlayerInteractEvent event) {
}
}


//Spectator disables:
if (ply.isInMinigame() && pdata.getMinigamePlayer(event.getPlayer()).getMinigame().isSpectator(pdata.getMinigamePlayer(event.getPlayer()))) {
event.setCancelled(true);
Expand Down Expand Up @@ -458,7 +459,11 @@ private void entityDamageEntity(EntityDamageByEntityEvent event) {
if (sb.getShooter() instanceof Player player) {
MinigamePlayer shooter = pdata.getMinigamePlayer(player);
Minigame mgm = ply.getMinigame();
if (shooter == null) return;

if (shooter == null) {
return;
}

if (shooter.isInMinigame() && shooter.getMinigame().equals(ply.getMinigame())) {
if (!shooter.canPvP()) {
event.setCancelled(true);
Expand Down Expand Up @@ -627,13 +632,14 @@ private void spectatorAttack(EntityDamageByEntityEvent event) {

@EventHandler(ignoreCancelled = true)
private void clickMenu(InventoryClickEvent event) {
MinigamePlayer ply = pdata.getMinigamePlayer((Player) event.getWhoClicked());
if (ply.isInMenu()) {
if (event.getRawSlot() < ply.getMenu().getSize()) {
if (!ply.getMenu().getAllowModify() || ply.getMenu().hasMenuItem(event.getRawSlot()))
MinigamePlayer mgPlayer = pdata.getMinigamePlayer(((Player) event.getWhoClicked()));
if (mgPlayer.isInMenu()) {
if (event.getRawSlot() < mgPlayer.getMenu().getSize()) {
if (!mgPlayer.getMenu().getAllowModify() || mgPlayer.getMenu().hasMenuItem(event.getRawSlot())) {
event.setCancelled(true);
}

MenuItem item = ply.getMenu().getClicked(event.getRawSlot());
MenuItem item = mgPlayer.getMenu().getClicked(event.getRawSlot());
if (item != null) {
ItemStack disItem = null;
switch (event.getClick()) {
Expand All @@ -651,12 +657,38 @@ private void clickMenu(InventoryClickEvent event) {

event.setCurrentItem(disItem);
}
/*
* Cancel special cases, where event.getRawSlot() is not in the Menu inventory,
* but the event modifies it anyway
*/
} else if (!mgPlayer.getMenu().getAllowModify()) {
Inventory topInv = event.getView().getTopInventory();
switch (event.getAction()) {
case PICKUP_ALL, PICKUP_SOME, PICKUP_HALF, PICKUP_ONE, DROP_ALL_SLOT, DROP_ONE_SLOT, HOTBAR_MOVE_AND_READD, // may take
PLACE_ALL, PLACE_SOME, PLACE_ONE, /*may place*/
SWAP_WITH_CURSOR, HOTBAR_SWAP /*may give and take*/ -> {
if (event.getClickedInventory() == topInv) {
event.setCancelled(true);
}
}
case COLLECT_TO_CURSOR -> { // may take complex
if (topInv.contains(event.getCursor().getType())) {
event.setCancelled(true);
}
}
case MOVE_TO_OTHER_INVENTORY -> {
event.setCancelled(true);
} // definitely one or the other
default -> {
} // do nothing for any other action
}
}
} else if (ply.isInMinigame()) {
if (!ply.getLoadout().allowOffHand() && event.getSlot() == 40) {

} else if (mgPlayer.isInMinigame()) {
if (!mgPlayer.getLoadout().allowOffHand() && event.getSlot() == 40) {
event.setCancelled(true);
} else if ((ply.getLoadout().isArmourLocked() && event.getSlot() >= 36 && event.getSlot() <= 39) ||
(ply.getLoadout().isInventoryLocked() && event.getSlot() >= 0 && event.getSlot() <= 35)) {
} else if ((mgPlayer.getLoadout().isArmourLocked() && event.getSlot() >= 36 && event.getSlot() <= 39) ||
(mgPlayer.getLoadout().isInventoryLocked() && event.getSlot() >= 0 && event.getSlot() <= 35)) {
event.setCancelled(true);
}
}
Expand Down Expand Up @@ -715,7 +747,6 @@ private void manualItemEntry(AsyncPlayerChatEvent event) {
ply.getManualEntry().checkValidEntry(event.getMessage());
ply.setManualEntry(null);
}

}

@EventHandler(ignoreCancelled = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

public enum MinigameMessageType {
INFO,
WARN,
ERROR,
WIN,
LOSS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,9 @@ public static MinigameTool giveMinigameTool(MinigamePlayer player) {
*/
public static boolean hasMinigameTool(MinigamePlayer player) {
for (ItemStack i : player.getPlayer().getInventory().getContents()) {
if (i != null && i.getItemMeta() != null) {
if (i.getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Minigame Tool")) {
return true;
}
if (i != null && i.getItemMeta() != null &&
i.getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Minigame Tool")) {
return true;
}
}
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package au.com.mineauz.minigames;

import au.com.mineauz.minigames.backend.BackendManager;
import au.com.mineauz.minigames.blockRecorder.BasicRecorder;
import au.com.mineauz.minigames.commands.CommandDispatcher;
import au.com.mineauz.minigames.config.MinigameSave;
import au.com.mineauz.minigames.display.DisplayManager;
Expand All @@ -14,6 +13,7 @@
import au.com.mineauz.minigames.minigame.reward.RewardsModule;
import au.com.mineauz.minigames.objects.MinigamePlayer;
import au.com.mineauz.minigames.objects.ResourcePack;
import au.com.mineauz.minigames.recorder.BasicRecorder;
import au.com.mineauz.minigames.signs.SignBase;
import au.com.mineauz.minigames.stats.MinigameStats;
import au.com.mineauz.minigames.stats.StatValueField;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import au.com.mineauz.minigames.MinigameUtils;
import au.com.mineauz.minigames.Minigames;
import au.com.mineauz.minigames.blockRecorder.RecorderData;
import au.com.mineauz.minigames.minigame.Minigame;
import au.com.mineauz.minigames.minigame.MinigameState;
import au.com.mineauz.minigames.recorder.RecorderData;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;

Expand Down Expand Up @@ -64,7 +64,7 @@ public boolean onCommand(CommandSender sender, Minigame minigame,
minigame = Minigames.getPlugin().getMinigameManager().getMinigame(args[0]);
if (!minigame.getRegenRegions().isEmpty()) {
if (args.length == 1) {
if (minigame.getPlayers().size() == 0) {
if (minigame.getPlayers().isEmpty()) {
minigame.setState(MinigameState.REGENERATING);
Minigames.getPlugin().getMinigameManager().addRegenDataToRecorder(minigame);
RecorderData d = minigame.getRecorderData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ public static void registerCommand(ICommand command) {

public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
Player ply = null;
if (sender instanceof Player) {
ply = (Player) sender;
if (sender instanceof Player player) {
ply = player;
}

if (args != null && args.length > 0) {
Expand Down Expand Up @@ -222,11 +222,10 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
sender.sendMessage(ChatColor.RED + comd.getPermissionMessage());
sender.sendMessage(ChatColor.RED + comd.getPermission());
}
return true;
} else {
sender.sendMessage(ChatColor.RED + "You must be a player to execute this command!");
return true;
}
return true;
}
} else {
sender.sendMessage(ChatColor.GREEN + "Minigames");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,32 @@
import java.util.List;

public interface ICommand {
// public MinigamePlayerManager playerManager = Minigames.plugin.getPlayerData();
// public MinigameManager minigameManager = Minigames.plugin.getMinigameData();
Minigames plugin = Minigames.getPlugin();

/**
* get the name of this (sub) command
* the name get used as it's first parameter
* in case of the command /mg the set subcommand /mg set implements this interface,
* as well as every sub-subcommand of it. set is the name of this specific subcommand
* and the name of all the ones one layer down are its parameters.
*/
String getName();

/**
* Get the aliases to the name of this command.
* An alias is an alternative name that should also show up as a parameter
* but calls the same command.
*/
String[] getAliases();

/**
* If the command can be called from the console or if it is strictly only callable by a player
*/
boolean canBeConsole();

/**
* Used in help command to describe what this (sub)command does.
*/
String getDescription();

String[] getParameters();
Expand Down
Loading
Loading