Skip to content

Commit

Permalink
Players will now be force respawned when killed, countdown messages a…
Browse files Browse the repository at this point in the history
…re shown in the format of an ActionBar instead of using the xp level. 0.9.14.2 Pre Release.
  • Loading branch information
teozfrank committed May 17, 2015
1 parent ddd5d53 commit fb85ce2
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 12 deletions.
4 changes: 2 additions & 2 deletions DuelMe.iml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<orderEntry type="library" name="Maven: com.google.guava:guava:10.0.1" level="project" />
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
<orderEntry type="library" name="Maven: net.milkbowl.vault:Vault:1.4.1" level="project" />
<orderEntry type="library" name="Maven: org.bukkit:bukkit:1.8.3-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: org.spigotmc:spigot-api:1.8.3-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
Expand All @@ -26,7 +26,7 @@
<orderEntry type="library" name="Maven: org.avaje:ebean:2.8.1" level="project" />
<orderEntry type="library" name="Maven: javax.persistence:persistence-api:1.0" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.14" level="project" />
<orderEntry type="library" name="Maven: org.spigotmc:spigot-api:1.8.3-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: net.md-5:bungeecord-chat:1.8-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: org.bukkit:craftbukkit:1.8.3-R0.1-SNAPSHOT" level="project" />
</component>
</module>
13 changes: 8 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<properties>
<spigot.version>1.8.3-R0.1-SNAPSHOT</spigot.version>
<bukkit.version>1.8.3-R0.1-SNAPSHOT</bukkit.version>
<craftbukkit.version>1.8.3-R0.1-SNAPSHOT</craftbukkit.version>
<worldedit.version>6.0.0-SNAPSHOT</worldedit.version>
</properties>

Expand Down Expand Up @@ -45,16 +46,18 @@
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>${bukkit.version}</version>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${spigot.version}</version>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>${craftbukkit.version}</version>
<scope>compile</scope>
<type>jar</type>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public void onPlayerDeath(PlayerDeathEvent e) {
DuelManager dm = plugin.getDuelManager();
FileManager fm = plugin.getFileManager();
MySql mySql = plugin.getMySql();

if(dm.isInDuel(playerUUID)){
dm.addDeadPlayer(playerUUID);

Expand Down Expand Up @@ -72,7 +71,7 @@ public void onPlayerDeath(PlayerDeathEvent e) {
e.setDeathMessage(fm.getPrefix() + ChatColor.AQUA + player.getName() + ChatColor.RED + " was killed in a duel!");
}
dm.endDuel(player);

player.spigot().respawn();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public void run() {
}

if (this.duelTime > 0 && duelSize == 2) {
Util.setTime(sender, target, this.duelTime);
//Util.setTime(sender, target, this.duelTime);
Util.sendActionBarMessage(sender, target, ChatColor.GOLD + "Duel Ends in: " + ChatColor.AQUA + this.duelTime);
this.duelTime--;
} else {
if(plugin.isDebugEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ of this software and associated documentation files (the "Software"), to deal

import com.teozcommunity.teozfrank.duelme.main.DuelMe;
import com.teozcommunity.teozfrank.duelme.util.*;
import net.milkbowl.vault.chat.Chat;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
Expand Down Expand Up @@ -73,7 +74,8 @@ public void run() {


if (this.countDown > 0 && duelSize == 2) {
Util.setTime(sender, target, this.countDown);
//Util.setTime(sender, target, this.countDown);
Util.sendActionBarMessage(sender, target, ChatColor.GOLD + "Starting duel in: " + ChatColor.AQUA + this.countDown);
this.countDown--;
} else {
if(duelSize == 2) {
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/com/teozcommunity/teozfrank/duelme/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ of this software and associated documentation files (the "Software"), to deal
import com.google.common.collect.Lists;
import com.teozcommunity.teozfrank.duelme.main.DuelMe;
import com.teozcommunity.teozfrank.duelme.threads.StartDuelThread;
import net.minecraft.server.v1_8_R2.IChatBaseComponent;
import net.minecraft.server.v1_8_R2.PacketPlayOutChat;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
Expand Down Expand Up @@ -235,5 +238,27 @@ public static ItemStack createMenuItem(DyeColor color, String name,List<String>
return wool;
}

/**
* send a action bar message to a player
* @param player the player to send the message to
* @param message the message to send the player
*/
public static void sendActionBarMessage(Player player, String message) {
PacketPlayOutChat packet = new PacketPlayOutChat(IChatBaseComponent.ChatSerializer.a("{ text: \"" + message + "\" }"), (byte) 2);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}

/**
* send a action bar message to two players
* @param sender the sender player
* @param target the target player
* @param message the message to send both players
*/
public static void sendActionBarMessage(Player sender, Player target, String message) {
PacketPlayOutChat packet = new PacketPlayOutChat(IChatBaseComponent.ChatSerializer.a("{ text: \"" + message + "\" }"), (byte) 2);
((CraftPlayer) sender).getHandle().playerConnection.sendPacket(packet);
((CraftPlayer) target).getHandle().playerConnection.sendPacket(packet);
}


}
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: DuelMe
version: 0.9.14.1 Pre Release
version: 0.9.14.2 Pre Release
author: teozfrank
description: allows players to duel each other in a controlled environment
main: com.teozcommunity.teozfrank.duelme.main.DuelMe
Expand Down

0 comments on commit fb85ce2

Please sign in to comment.