-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
#33 - Set players health and food level to full when duel starts - Players can leave the queue by using the /duel leave command Pre release 0.18.4
- Loading branch information
Showing
6 changed files
with
68 additions
and
7 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
.idea/libraries/Maven__org_spigotmc_spigot_api_1_10_R0_1_SNAPSHOT.xml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
53 changes: 53 additions & 0 deletions
53
Plugin/src/main/java/com/github/teozfrank/duelme/events/PlayerInteract.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,53 @@ | ||
package com.github.teozfrank.duelme.events; | ||
|
||
import com.github.teozfrank.duelme.main.DuelMe; | ||
import com.github.teozfrank.duelme.util.SendConsoleMessage; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.ChatColor; | ||
import org.bukkit.Material; | ||
import org.bukkit.block.Block; | ||
import org.bukkit.block.Sign; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.EventPriority; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.block.Action; | ||
import org.bukkit.event.player.PlayerInteractEvent; | ||
|
||
public class PlayerInteract implements Listener { | ||
|
||
private DuelMe plugin; | ||
|
||
public PlayerInteract(DuelMe plugin) { | ||
this.plugin = plugin; | ||
Bukkit.getPluginManager().registerEvents(this, plugin); | ||
} | ||
|
||
@EventHandler (priority = EventPriority.MONITOR) | ||
public void onPlayerInteractSign(PlayerInteractEvent e) { | ||
Player player = e.getPlayer(); | ||
Block clickedBlock = e.getClickedBlock(); | ||
Action action = e.getAction(); | ||
|
||
|
||
|
||
if(action == Action.RIGHT_CLICK_BLOCK) { | ||
|
||
if (! clickedBlock.getType().equals(Material.WALL_SIGN)) { | ||
return; | ||
} | ||
SendConsoleMessage.debug("Right click wall sign yay!."); | ||
|
||
try { | ||
Sign sign = (Sign) clickedBlock.getState(); | ||
String line1 = sign.getLine(0); | ||
line1 = ChatColor.stripColor(line1); | ||
if(line1.equals("[DuelMe]")) { | ||
player.performCommand("duel join"); | ||
} | ||
} catch (Exception ex) { | ||
|
||
} | ||
} | ||
} | ||
} |
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