Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Commit

Permalink
KingKits v5.1.0
Browse files Browse the repository at this point in the history
KingKits v5.1.0 update.
  • Loading branch information
FarisR99 committed Jan 9, 2016
1 parent 65ec43c commit b3b689e
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 9 deletions.
34 changes: 33 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.faris</groupId>
<artifactId>KingKits</artifactId>
<version>5.0.9</version>
<version>5.1.0</version>

<packaging>jar</packaging>

Expand All @@ -23,6 +23,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<github.global.server>github</github.global.server>
</properties>

<build>
Expand Down Expand Up @@ -95,6 +96,31 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.11</version>
<configuration>
<message>Maven artifacts for ${project.version}</message>
<noJekyll>true</noJekyll>
<outputDirectory>${project.build.directory}/mvn-repo</outputDirectory>
<branch>refs/heads/mvn-repo</branch>
<merge>true</merge>
<includes>
<include>**/*</include>
</includes>
<repositoryName>KingKits</repositoryName>
<repositoryOwner>KingFaris10</repositoryOwner>
</configuration>
<executions>
<execution>
<goals>
<goal>site</goal>
</goals>
<phase>deploy</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -139,4 +165,10 @@
</dependency>
</dependencies>

<scm>
<connection>scm:git:git@github.com:KingFaris10/KingKits.git</connection>
<url>scm:git:git@github.com:KingFaris10/KingKits.git</url>
<developerConnection>scm:git:git@github.com:KingFaris10/KingKits.git</developerConnection>
</scm>

</project>
21 changes: 16 additions & 5 deletions src/main/java/com/faris/kingkits/controller/GuiController.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,23 @@ public GuiListener getListener() {
public void openKitsMenu(Player player) {
if (player != null && !this.guiViewers.containsKey(player.getUniqueId())) {
player.closeInventory();
Inventory inventory = this.createKitsMenuInventory(player);
if (inventory != null) {
this.guiViewers.put(player.getUniqueId(), GuiType.GUI_KITS_MENU);
player.openInventory(inventory);
KitPlayer kitPlayer = PlayerController.getInstance().getPlayer(player);
if (kitPlayer != null && kitPlayer.getKits().isEmpty()) {
Inventory inventory = this.createKitsInventory(player);
if (inventory != null) {
this.guiViewers.put(player.getUniqueId(), GuiType.GUI_KITS);
player.openInventory(inventory);
} else {
this.guiKits.remove(player.getUniqueId());
}
} else {
this.guiKits.remove(player.getUniqueId());
Inventory inventory = this.createKitsMenuInventory(player);
if (inventory != null) {
this.guiViewers.put(player.getUniqueId(), GuiType.GUI_KITS_MENU);
player.openInventory(inventory);
} else {
this.guiKits.remove(player.getUniqueId());
}
}
}
}
Expand Down
22 changes: 19 additions & 3 deletions src/main/java/com/faris/kingkits/listener/EventListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.bukkit.potion.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.logging.Level;
Expand Down Expand Up @@ -312,10 +313,23 @@ public void onPlayerDeath(PlayerDeathEvent event) {
kitPlayer.onDeath();
if (killer != null && !player.getUniqueId().equals(killer.getUniqueId())) {
kitPlayer.setScore(Math.min(Math.max(kitPlayer.getScore() + ConfigController.getInstance().getScorePerDeath(), 0), ConfigController.getInstance().getMaxScore()));

final KitPlayer killerPlayer = PlayerController.getInstance().getPlayer(killer);
if (killerPlayer != null) {
killerPlayer.incrementKillstreak();
if (killerPlayer.getKit() != null) {
killerPlayer.incrementKillstreak();
if (killerPlayer.getKit().getKillstreaks().containsKey(killerPlayer.getKillstreak())) {
List<String> killstreakCmds = killerPlayer.getKit().getKillstreaks().get(killerPlayer.getKillstreak());
if (killstreakCmds != null) {
for (String killstreakCmd : killstreakCmds) {
try {
killer.getServer().dispatchCommand(killer.getServer().getConsoleSender(), killstreakCmd.replace("<player>", killer.getName()).replace("<username>", killer.getName()).replace("<name>", killer.getName()).replace("<killstreak>", String.valueOf(killerPlayer.getKillstreak())));
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
}
}
killerPlayer.setScore(Math.min(Math.max(killerPlayer.getScore() + ConfigController.getInstance().getScorePerKill(), 0), ConfigController.getInstance().getMaxScore()));
try {
for (Kit kit : KitController.getInstance().getKits().values()) {
Expand Down Expand Up @@ -733,7 +747,9 @@ public void run() {
@Override
public void run() {
if (player.isOnline()) {
player.getServer().broadcastMessage(ChatColor.GOLD + "[" + ChatColor.BOLD + ChatColor.AQUA + "KingKits" + ChatColor.GOLD + "] " + ChatColor.RED + "The server took too long to load " + player.getName() + "'s data. They have been kicked from the server.");
for (Player onlinePlayer : player.getServer().getOnlinePlayers()) {
if (onlinePlayer.isOp() || onlinePlayer.hasPermission("*")) onlinePlayer.sendMessage(ChatColor.GOLD + "[" + ChatColor.BOLD + ChatColor.AQUA + "KingKits" + ChatColor.GOLD + "] " + ChatColor.RED + "The server took too long to load " + player.getName() + "'s data. They have been kicked from the server.");
}
player.kickPlayer(ChatColor.RED + "[KingKits] Server took too long to respond!\n" + ChatColor.RED + "Could not load your data.");
}
}
Expand Down

0 comments on commit b3b689e

Please sign in to comment.