Clans: Modifications to map stuff, fix food level depleting too fast

This commit is contained in:
libraryaddict 2015-07-17 00:30:34 +12:00
parent ae71de30db
commit aaee5f01ce
3 changed files with 15 additions and 3 deletions

View File

@ -21,6 +21,7 @@ import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -169,6 +170,12 @@ public class ClansGame extends MiniPlugin
} }
@EventHandler
public final void onFoodLevelChangeEvent(FoodLevelChangeEvent event)
{
((Player) event.getEntity()).setSaturation(3.8F); // While not entirely accurate, this is a pretty good guess at original food level changes
}
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)
public void BlockBreak(BlockBreakEvent event) public void BlockBreak(BlockBreakEvent event)
{ {

View File

@ -519,6 +519,8 @@ public class ItemMapManager extends MiniPlugin
|| item.getDurability() > _mapId + 100) || item.getDurability() > _mapId + 100)
return; return;
event.setCancelled(true);
Player player = event.getPlayer(); Player player = event.getPlayer();
MapInfo info = getMap(player); MapInfo info = getMap(player);

View File

@ -77,6 +77,7 @@ public class ItemMapRenderer extends MapRenderer
if (owningClan != null) if (owningClan != null)
{ {
boolean colorAll = scale > 0;
Color clanColor = null; Color clanColor = null;
if (owningClan == clan) if (owningClan == clan)
@ -87,6 +88,8 @@ public class ItemMapRenderer extends MapRenderer
{ {
if (owningClan.isAdmin()) if (owningClan.isAdmin())
{ {
colorAll = false;
if (owningClan.getName().equals("Shops") || owningClan.getName().equals("Spawn")) if (owningClan.getName().equals("Shops") || owningClan.getName().equals("Spawn"))
{ {
clanColor = Color.WHITE; clanColor = Color.WHITE;
@ -121,7 +124,7 @@ public class ItemMapRenderer extends MapRenderer
int chunkX1 = (int) Math.floor(blockX / 16D); int chunkX1 = (int) Math.floor(blockX / 16D);
int chunkZ1 = (int) Math.floor(blockZ / 16D); int chunkZ1 = (int) Math.floor(blockZ / 16D);
if ( if (colorAll ||
((chunkBX == 0 || zoom == 13) && ((chunkBX == 0 || zoom == 13) &&
@ -140,7 +143,7 @@ public class ItemMapRenderer extends MapRenderer
owningClan != _manager.getClansUtility().getOwner("world," + chunkX1 + "," + (chunkZ1 + 1)))) owningClan != _manager.getClansUtility().getOwner("world," + chunkX1 + "," + (chunkZ1 + 1))))
{ {
Color cColor = MapPalette.getColor(color); Color cColor = MapPalette.getColor(color);
double clans = 0.65; double clans = colorAll ? 1 : 0.8;// 0.65;
double base = 1 - clans; double base = 1 - clans;
int r = (int) ((cColor.getRed() * base) + (clanColor.getRed() * clans)); int r = (int) ((cColor.getRed() * base) + (clanColor.getRed() * clans));
@ -153,7 +156,7 @@ public class ItemMapRenderer extends MapRenderer
{ {
Color cColor = MapPalette.getColor(color); Color cColor = MapPalette.getColor(color);
double clans = 0.4; double clans = 0.65;// 0.4;
double base = 1 - clans; double base = 1 - clans;
int r = (int) ((cColor.getRed() * base) + (clanColor.getRed() * clans)); int r = (int) ((cColor.getRed() * base) + (clanColor.getRed() * clans));