-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
These changes were on my PC, pushing to main
- Loading branch information
1 parent
8d99e93
commit 43a3cb0
Showing
11 changed files
with
171 additions
and
30 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,46 @@ | ||
package com.burchard36.api; | ||
|
||
import com.burchard36.api.command.ApiCommand; | ||
import com.burchard36.api.command.actions.SubArgument; | ||
import com.burchard36.api.command.annotation.CommandName; | ||
import org.bukkit.Material; | ||
import org.bukkit.OfflinePlayer; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.inventory.ItemStack; | ||
|
||
@CommandName(name = "help") | ||
public class TestArgument extends ApiCommand { | ||
|
||
public static void onArgument(SubArgument arg) { | ||
|
||
} | ||
|
||
public TestArgument() { | ||
this.subArgument("test", (subArgument) -> { | ||
if (!subArgument.senderIsPlayer()) return; | ||
|
||
}); | ||
this.subArgument("testtt", null, TestArgument::onArgument) | ||
.subArgument("test", null, (subArgument) -> { | ||
if (!subArgument.senderIsPlayer()) return; | ||
|
||
}) | ||
.subArgument("test %player%", "needs.me", (subArgument) -> { | ||
if (subArgument.playerPresentAt(1).isEmpty()) return;// send msg, maybe have boolean return | ||
final OfflinePlayer player = subArgument.playerPresentAt(1).get(); | ||
subArgument.commandSender().sendMessage("You sent me: " + player.getName()); | ||
}) | ||
.subArgument("give %player% %item% %amount%", "needs.give", (subArgument) -> { | ||
if (subArgument.playerPresentAt(1).isEmpty()) return; // send msg, maybe have boolean return | ||
if (subArgument.integerPresentAt(2).isEmpty()) return; // send msg, maybe have boolean return | ||
if (subArgument.materialPresentAt(3).isEmpty()) return; // send msg, maybe have boolean return | ||
|
||
final OfflinePlayer offlinePlayer = subArgument.playerPresentAt(1).get(); | ||
if (offlinePlayer.isOnline()) { | ||
final Player player = ((Player) offlinePlayer); | ||
final Material mat = subArgument.materialPresentAt(3).get(); | ||
final int amt = subArgument.integerPresentAt(2).get(); | ||
player.getInventory().addItem(new ItemStack(mat, amt)); | ||
} | ||
}) | ||
.onPlayerSender((playerSent) -> playerSent.player().sendMessage("Dumbass you need to send arguments")) | ||
.onConsoleSender((consoleSent) -> consoleSent.console().sendMessage("Your even more stupid, you sent it through console!")); | ||
} | ||
} |
31 changes: 30 additions & 1 deletion
31
src/main/java/com/burchard36/api/command/actions/SubArgument.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
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
Oops, something went wrong.