Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added /putdown toggle command
- Loading branch information
Showing
5 changed files
with
170 additions
and
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* | ||
*/ | ||
package com.jynxdaddy.wolfspawn; | ||
|
||
import java.util.logging.Logger; | ||
|
||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandExecutor; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
|
||
/** | ||
* Handler for /putdown command | ||
* @author Ashton | ||
* | ||
*/ | ||
public class PutDownCommand implements CommandExecutor { | ||
|
||
@SuppressWarnings("unused") | ||
private WolfSpawn plugin; | ||
@SuppressWarnings("unused") | ||
private static Logger log; | ||
|
||
public PutDownCommand(WolfSpawn wolfSpawn) { | ||
this.plugin = wolfSpawn; | ||
PutDownCommand.log = WolfSpawn.log; | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see org.bukkit.command.CommandExecutor#onCommand(org.bukkit.command.CommandSender, org.bukkit.command.Command, java.lang.String, java.lang.String[]) | ||
*/ | ||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { | ||
if (sender instanceof Player) { | ||
Player player = (Player) sender; | ||
if (plugin.addPutDownPlayer(player.getName())) { | ||
player.sendMessage("[WolfSpawn] PutDown enabled - your wolves won't respawn"); | ||
} | ||
else { | ||
plugin.removePutDownPlayer(player.getName()); //toggle off | ||
player.sendMessage("[WolfSpawn] PutDown disabled - your wolves will respawn again"); | ||
} | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/jynxdaddy/wolfspawn/WPlayerListener.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,26 @@ | ||
/** | ||
* | ||
*/ | ||
package com.jynxdaddy.wolfspawn; | ||
|
||
import java.util.logging.Logger; | ||
|
||
import org.bukkit.event.player.PlayerListener; | ||
|
||
/** | ||
* @author Ashton | ||
* | ||
*/ | ||
public class WPlayerListener extends PlayerListener { | ||
|
||
@SuppressWarnings("unused") | ||
private WolfSpawn plugin; | ||
@SuppressWarnings("unused") | ||
private static Logger log; | ||
|
||
public WPlayerListener(WolfSpawn plugin) { | ||
this.plugin = plugin; | ||
WPlayerListener.log = WolfSpawn.log; | ||
} | ||
|
||
} |
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