-
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.
Merge pull request #1 from SmartGecko44/experimental
Experimental -> master
- Loading branch information
Showing
8 changed files
with
197 additions
and
76 deletions.
There are no files selected for viewing
This file was deleted.
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
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
38 changes: 38 additions & 0 deletions
38
src/main/java/org/gecko/wauh/commands/SetRadiusLimitCommand.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,38 @@ | ||
package org.gecko.wauh.commands; | ||
|
||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandExecutor; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
import org.gecko.wauh.Main; | ||
|
||
public class SetRadiusLimitCommand implements CommandExecutor { | ||
private final Main plugin; // Reference to the Main class | ||
|
||
public SetRadiusLimitCommand(Main plugin) { | ||
this.plugin = plugin; | ||
} | ||
|
||
@Override | ||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { | ||
if (sender instanceof Player) { | ||
Player player = (Player) sender; | ||
|
||
if (args.length == 1) { | ||
// Check if the argument is an integer | ||
try { | ||
int newLimit = Integer.parseInt(args[0]); | ||
plugin.setRadiusLimit(newLimit); // Use the setter method | ||
player.sendMessage("Radius limit set to " + newLimit); | ||
} catch (NumberFormatException e) { | ||
player.sendMessage("Please specify a valid integer."); | ||
} | ||
} else { | ||
player.sendMessage("Usage: /setradiuslimit <integer>"); | ||
} | ||
} else { | ||
sender.sendMessage("Only players can use this command."); | ||
} | ||
return true; | ||
} | ||
} |
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,43 @@ | ||
package org.gecko.wauh.commands; | ||
|
||
import org.bukkit.ChatColor; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandExecutor; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
import org.gecko.wauh.barriuh.BarrierListener; | ||
import org.gecko.wauh.wauhbuck.BucketListener; | ||
|
||
public class StopWauh implements CommandExecutor { | ||
private final BucketListener bucketListener; | ||
private final BarrierListener barrierListener; | ||
|
||
public StopWauh(BucketListener bucketListener, BarrierListener barrierListener) { | ||
this.bucketListener = bucketListener; | ||
this.barrierListener = barrierListener; | ||
} | ||
|
||
@Override | ||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { | ||
if (!(sender instanceof Player)) { | ||
sender.sendMessage(ChatColor.RED + "Only players can use this command."); | ||
return true; | ||
} | ||
|
||
Player player = (Player) sender; | ||
|
||
if (bucketListener.wauhRemovalActive) { | ||
bucketListener.stopWaterRemoval = true; | ||
player.sendMessage(ChatColor.GREEN + "Wauh removal " + ChatColor.RED + ChatColor.BOLD + "stopped."); | ||
} | ||
if (barrierListener.blockRemovalActive) { | ||
barrierListener.stopBlockRemoval = true; | ||
player.sendMessage(ChatColor.GREEN + "Block removal " + ChatColor.RED + ChatColor.BOLD + "stopped."); | ||
} | ||
if (!bucketListener.wauhRemovalActive && !barrierListener.blockRemovalActive) { | ||
player.sendMessage(ChatColor.RED + "There are no block removals running"); | ||
} | ||
|
||
return true; | ||
} | ||
} |
Oops, something went wrong.