forked from vexsoftware/votifier
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support to execute a command when a player votes
- Loading branch information
Showing
4 changed files
with
27 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.kryeit.votifier.utils; | ||
|
||
import com.kryeit.votifier.MinecraftServerSupplier; | ||
import net.minecraft.server.command.ServerCommandSource; | ||
|
||
public class Utils { | ||
|
||
public static void executeCommandAsServer(String command) { | ||
// Create a command source that represents the server | ||
ServerCommandSource source = MinecraftServerSupplier.getServer().getCommandSource(); | ||
|
||
// Execute the command | ||
MinecraftServerSupplier.getServer().getCommandManager().executeWithPrefix(source, command); | ||
} | ||
} |
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,5 +1,6 @@ | ||
{ | ||
"host": "0.0.0.0", | ||
"port": "8192", | ||
"debug": false | ||
"debug": false, | ||
"command-after-voting": "give %player% diamond 1", | ||
} |