Skip to content

Commit

Permalink
Merge branch '2.8.3' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
net committed Oct 4, 2016
2 parents 21e807d + ba5c450 commit d400147
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 17 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<groupId>org.mctourney.autoreferee</groupId>
<artifactId>AutoReferee</artifactId>
<version>2.8.2</version>
<version>2.8.3</version>
<name>AutoReferee Core Plugin</name>
<url>https://www.reddit.com/r/mctourney</url>
<description>Bukkit plugin for automatically refereeing competitive Minecraft matches.</description>
Expand Down Expand Up @@ -95,7 +95,7 @@
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2</version>
<version>3.2.2</version>
</dependency>

<dependency>
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/org/mctourney/autoreferee/AutoRefMatch.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,14 @@ public boolean isPracticeMode()
return existingteams < 2;
}

public boolean willBePracticeMode()
{
int existingteams = 0;
for (AutoRefTeam team : this.getTeams())
if (!team.isEmptyTeam()) ++existingteams;
return existingteams < 2;
}

protected boolean previewMode = false;

public void setPreviewMode(boolean b)
Expand Down
16 changes: 13 additions & 3 deletions src/main/java/org/mctourney/autoreferee/AutoRefPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -718,8 +718,12 @@ public void registerDeath(PlayerDeathEvent e, Location from)
{
// sanity check...
if (e.getEntity() != getPlayer()) return;
try{
this.saveInventoryView();

} catch (IllegalArgumentException ex){
//Print a stack trace if inventory sizes change in future updates.
ex.printStackTrace();
}
// if this player has a number of lives, reduce by one
if (hasLives()) --livesRemaining;

Expand Down Expand Up @@ -956,9 +960,15 @@ public Inventory getInventoryView(String name)

PlayerInventory pInventory = player.getInventory();
String inventoryName = name.length() > 32 ? name.substring(0, 32) : name;

// Player inventory grew by a slot in 1.9
// This code ensures that no matter how many slots we have, we're always a multiple of 9
int displayInventorySize = pInventory.getSize() + 9 + (9 - (pInventory.getSize() % 9));
Inventory inventoryView = Bukkit.getServer().createInventory(null,
pInventory.getSize() + 9, inventoryName);

displayInventorySize, inventoryName);



ItemStack[] oldContents = pInventory.getContents();
ItemStack[] newContents = inventoryView.getContents();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,17 +250,22 @@ public boolean ready(CommandSender sender, AutoRefMatch match, String[] args, Co
match.cancelCountdown();
}

// if console or referee sends this message
if (sender instanceof ConsoleCommandSender || match.isReferee(player))
{
// attempt to set the ready delay if one is specified
try { if (options.hasOption('s')) match.setReadyDelay(Integer.parseInt(options.getOptionValue('s'))); }
catch (NumberFormatException e) { };
// Reset the ready delay.
match.setReadyDelay(-1);

// If a ready delay is specified (-s), and the delay is authorized (practise mode or ref), then set the delay.
if (options.hasOption('s')
&& (match.willBePracticeMode() || sender instanceof ConsoleCommandSender || match.isReferee(player))) {
try {
match.setReadyDelay(Integer.parseInt(options.getOptionValue('s')));
} catch (NumberFormatException e) { }
}

// if console or referee sends this message
if (sender instanceof ConsoleCommandSender || match.isReferee(player)) {
match.setRefereeReady(rstate);
}
else
{
else {
AutoRefTeam team = match.getPlayerTeam(player);
if (team != null) team.setReady(rstate);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,14 @@ public void creatureSpawn(CreatureSpawnEvent event)
@EventHandler(priority= EventPriority.HIGHEST)
public void projectileLaunch(ProjectileLaunchEvent event)
{
LivingEntity shooter = (LivingEntity) event.getEntity().getShooter();
if (shooter != null && checkAdminPrivilege(shooter)) return;

//Some nonliving entities can shoot
if (event.getEntity().getShooter() instanceof LivingEntity){
LivingEntity shooter = (LivingEntity) event.getEntity().getShooter();
if (shooter != null && checkAdminPrivilege(shooter)) return;
}
if (event.getEntity().getWorld() == plugin.getLobbyWorld())
event.setCancelled(true);

}

@EventHandler(priority=EventPriority.HIGHEST)
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/mctourney/autoreferee/util/ArmorPoints.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ public static int fromPlayerInventory(PlayerInventory inv)
{
int armorPoints = 0;
for (ItemStack item : inv.getArmorContents())
if (item != null){
armorPoints += ArmorPoints.fromItemStack(item);
}
return armorPoints;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: AutoReferee
main: org.mctourney.autoreferee.AutoReferee
version: 2.8.2
version: 2.8.3
author: "authorblues, net"
load: startup

Expand Down

0 comments on commit d400147

Please sign in to comment.