Rebuild patches for scoreboard API pull to Bukkit.

This commit is contained in:
md_5 2015-05-29 19:35:21 +10:00
parent c22f803441
commit b528389cd0
58 changed files with 7 additions and 239 deletions

View File

@ -1,73 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Thu, 17 Apr 2014 19:22:26 +1000
Subject: [PATCH] Expand team API to allow arbitrary strings.
diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/scoreboard/Team.java
+++ b/src/main/java/org/bukkit/scoreboard/Team.java
@@ -0,0 +0,0 @@ public interface Team {
*/
Set<OfflinePlayer> getPlayers() throws IllegalStateException;
+ // Spigot start
+ /**
+ * Same as the player method, but with an arbitrary string.
+ *
+ * @see #getPlayers()
+ */
+ Set<String> getEntries() throws IllegalStateException;
+ // Spigot End
+
/**
* Gets the size of the team
*
@@ -0,0 +0,0 @@ public interface Team {
*/
void addPlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException;
+ // Spigot start
+ /**
+ * Same as the player method, but with an arbitrary string.
+ *
+ * @see #addPlayer(org.bukkit.OfflinePlayer)
+ */
+ void addEntry(String entry) throws IllegalStateException, IllegalArgumentException;
+ // Spigot end
+
/**
* Removes the player from this team.
*
@@ -0,0 +0,0 @@ public interface Team {
*/
boolean removePlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException;
+ // Spigot start
+ /**
+ * Same as the player method, but with an arbitrary string.
+ *
+ * @see #removePlayer(org.bukkit.OfflinePlayer)
+ */
+ boolean removeEntry(String entry) throws IllegalStateException, IllegalArgumentException;
+ // Spigot end
+
/**
* Unregisters this team from the Scoreboard
*
@@ -0,0 +0,0 @@ public interface Team {
* @throws IllegalStateException if this team has been unregistered
*/
boolean hasPlayer(OfflinePlayer player) throws IllegalArgumentException, IllegalStateException;
+
+ // Spigot start
+ /**
+ * Same as the player method, but with an arbitrary string.
+ *
+ * @see #hasPlayer(org.bukkit.OfflinePlayer)
+ */
+ boolean hasEntry(String entry) throws IllegalArgumentException,IllegalStateException;
+ // Spigot end
}
--

View File

@ -159,36 +159,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ // Spigot end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
@@ -0,0 +0,0 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
return !(this.team != other.team && (this.team == null || !this.team.equals(other.team)));
}
+ // Spigot start
+ @Override
+ public Set<String> getEntries() throws IllegalStateException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void addEntry(String entry) throws IllegalStateException, IllegalArgumentException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean removeEntry(String entry) throws IllegalStateException, IllegalArgumentException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean hasEntry(String entry) throws IllegalArgumentException, IllegalStateException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ // Spigot end
}
--

View File

@ -1,114 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Thu, 17 Apr 2014 19:22:22 +1000
Subject: [PATCH] Expand team API to allow arbitrary strings.
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
@@ -0,0 +0,0 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
return players.build();
}
+ // Spigot start
+ @Override
+ public Set<String> getEntries() throws IllegalStateException {
+ CraftScoreboard scoreboard = checkState();
+
+ ImmutableSet.Builder<String> entries = ImmutableSet.builder();
+ for (Object o : team.getPlayerNameSet()){
+ entries.add(o.toString());
+ }
+ return entries.build();
+ }
+ // Spigot end
+
public int getSize() throws IllegalStateException {
CraftScoreboard scoreboard = checkState();
@@ -0,0 +0,0 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
public void addPlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException {
Validate.notNull(player, "OfflinePlayer cannot be null");
+ // Spigot Start
+ addEntry(player.getName());
+ }
+
+ public void addEntry(String entry) throws IllegalStateException, IllegalArgumentException {
+ Validate.notNull(entry, "Entry cannot be null");
CraftScoreboard scoreboard = checkState();
- scoreboard.board.addPlayerToTeam(player.getName(), team.getName());
+ scoreboard.board.addPlayerToTeam(entry, team.getName());
+ // Spigot end
}
public boolean removePlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException {
Validate.notNull(player, "OfflinePlayer cannot be null");
+ // Spigot start
+ return removeEntry(player.getName());
+ }
+
+ public boolean removeEntry(String entry) throws IllegalStateException, IllegalArgumentException {
+ Validate.notNull(entry, "Entry cannot be null");
CraftScoreboard scoreboard = checkState();
- if (!team.getPlayerNameSet().contains(player.getName())) {
+ if (!team.getPlayerNameSet().contains(entry)) {
return false;
}
- scoreboard.board.removePlayerFromTeam(player.getName(), team);
+ scoreboard.board.removePlayerFromTeam(entry, team);
+ // Spigot end
return true;
}
public boolean hasPlayer(OfflinePlayer player) throws IllegalArgumentException, IllegalStateException {
Validate.notNull(player, "OfflinePlayer cannot be null");
+ // Spigot start
+ return hasEntry(player.getName());
+ }
+
+ public boolean hasEntry(String entry) throws IllegalArgumentException, IllegalStateException {
+ Validate.notNull("Entry cannot be null");
+
CraftScoreboard scoreboard = checkState();
- return team.getPlayerNameSet().contains(player.getName());
+ return team.getPlayerNameSet().contains(entry);
+ // Spigot end
}
@Override
@@ -0,0 +0,0 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
final CraftTeam other = (CraftTeam) obj;
return !(this.team != other.team && (this.team == null || !this.team.equals(other.team)));
}
-
- // Spigot start
- @Override
- public Set<String> getEntries() throws IllegalStateException {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void addEntry(String entry) throws IllegalStateException, IllegalArgumentException {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public boolean removeEntry(String entry) throws IllegalStateException, IllegalArgumentException {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public boolean hasEntry(String entry) throws IllegalArgumentException, IllegalStateException {
- throw new UnsupportedOperationException("Not supported yet.");
- }
// Spigot end
}
--

View File

@ -32,6 +32,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ userCacheCap = getInt( "settings.user-cache-size", 1000 );
+ }
}
--
1.9.0.msysgit.0
--

View File

@ -51,6 +51,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ saveUserCacheOnStopOnly = getBoolean( "settings.save-user-cache-on-stop-only", false );
+ }
}
--
1.9.0.msysgit.0
--

View File

@ -57,6 +57,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ intCacheLimit = getInt( "settings.int-cache-limit", 1024 );
+ }
}
--
1.9.0.msysgit.0
--

View File

@ -33,6 +33,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ movedWronglyThreshold = getDouble( "settings.moved-wrongly-threshold", 0.0625D );
+ }
}
--
1.9.0.msysgit.0
--

View File

@ -33,6 +33,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ movedTooQuicklyThreshold = getDouble( "settings.moved-too-quickly-threshold", 100.0D );
+ }
}
--
1.9.0.msysgit.0
--

View File

@ -70,6 +70,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ ( (AttributeRanged) GenericAttributes.ATTACK_DAMAGE ).b = attackDamage;
+ }
}
--
1.9.0.msysgit.0
--

View File

@ -62,6 +62,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
</Root>
</Loggers>
</Configuration>
--
1.9.0.msysgit.0
--