Queueing now works with less players than teams.
Added DragonName text-input for hub Fixed smash bug, where spectators were causing lightning effect
This commit is contained in:
parent
30c5267da2
commit
72bec77237
|
@ -34,6 +34,9 @@ public class Dragon extends MiniPlugin
|
|||
public double RangeBest = 1000;
|
||||
public long RangeTime = 0;
|
||||
|
||||
public int textA = 0;
|
||||
public int textB = 0;
|
||||
|
||||
public Dragon(HubManager manager)
|
||||
{
|
||||
super("Dragon Manager", manager.GetPlugin());
|
||||
|
@ -98,15 +101,21 @@ public class Dragon extends MiniPlugin
|
|||
if (Dragon == null || !Dragon.isValid())
|
||||
return;
|
||||
|
||||
ChatColor color = ChatColor.RED;
|
||||
double r = Math.random();
|
||||
if (r > 0.83) color = ChatColor.GOLD;
|
||||
else if (r > 0.66) color = ChatColor.YELLOW;
|
||||
else if (r > 0.49) color = ChatColor.GREEN;
|
||||
else if (r > 0.32) color = ChatColor.AQUA;
|
||||
else if (r > 0.16) color = ChatColor.LIGHT_PURPLE;
|
||||
ChatColor aCol = ChatColor.RED;
|
||||
if (textA == 1) aCol = ChatColor.GOLD;
|
||||
else if (textA == 2) aCol = ChatColor.YELLOW;
|
||||
else if (textA == 3) aCol = ChatColor.GREEN;
|
||||
else if (textA == 4) aCol = ChatColor.AQUA;
|
||||
else if (textA == 5) aCol = ChatColor.LIGHT_PURPLE;
|
||||
|
||||
Dragon.setCustomName(color + C.Bold + C.Line + "Welcome to Mineplex - Home of Premium Quality Minigames");
|
||||
textA = (textA+1)%6;
|
||||
|
||||
ChatColor bCol = ChatColor.GREEN;
|
||||
if (textB > 6) bCol = ChatColor.WHITE;
|
||||
|
||||
textB = (textB+1)%14;
|
||||
|
||||
Dragon.setCustomName(aCol + C.Bold + C.Line + Manager.DragonTextA +ChatColor.RESET + " - " + bCol + C.Bold + C.Line + Manager.DragonTextB);
|
||||
}
|
||||
|
||||
private void Turn()
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
package mineplex.hub;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
|
@ -67,6 +74,9 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||
|
||||
private String _pigStacker = "0 - Nobody";
|
||||
|
||||
public String DragonTextA = "Mineplex";
|
||||
public String DragonTextB = "";
|
||||
|
||||
private HashSet<LivingEntity> _mobs = new HashSet<LivingEntity>();
|
||||
|
||||
public HubManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, DisguiseManager disguiseManager)
|
||||
|
@ -81,37 +91,82 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||
|
||||
new TextCreator(this);
|
||||
new Dragon(this);
|
||||
|
||||
DragonTextB = GetDragonText();
|
||||
}
|
||||
|
||||
public String GetDragonText()
|
||||
{
|
||||
File file = new File("DragonText.dat");
|
||||
|
||||
//Write If Blank
|
||||
if (!file.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
FileWriter fstream = new FileWriter(file);
|
||||
BufferedWriter out = new BufferedWriter(fstream);
|
||||
|
||||
out.write("Home of Premium Game Modes");
|
||||
|
||||
out.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("Error: Game World GetId Write Exception");
|
||||
}
|
||||
}
|
||||
|
||||
String line = "Home of Premium Game Modes";
|
||||
|
||||
//Read
|
||||
try
|
||||
{
|
||||
FileInputStream fstream = new FileInputStream(file);
|
||||
DataInputStream in = new DataInputStream(fstream);
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
||||
line = br.readLine();
|
||||
|
||||
in.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("Error: Game World GetId Read Exception");
|
||||
}
|
||||
|
||||
return line;
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void PlayerRespawn(PlayerRespawnEvent event)
|
||||
{
|
||||
event.setRespawnLocation(GetSpawn());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void OnChunkLoad(ChunkLoadEvent event)
|
||||
{
|
||||
for (Entity entity : event.getChunk().getEntities())
|
||||
{
|
||||
if (entity instanceof LivingEntity)
|
||||
{
|
||||
if (((LivingEntity)entity).isCustomNameVisible() && ((LivingEntity)entity).getCustomName() != null)
|
||||
{
|
||||
if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("minekartrider"))
|
||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "Play " + ChatColor.YELLOW + "MineKart"));
|
||||
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("defek7"))
|
||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "defek7"));
|
||||
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("chiss"))
|
||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "Chiss"));
|
||||
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("Sterling_"))
|
||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "sterling_"));
|
||||
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("Spu_"))
|
||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "Spu_"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void OnChunkLoad(ChunkLoadEvent event)
|
||||
{
|
||||
for (Entity entity : event.getChunk().getEntities())
|
||||
{
|
||||
if (entity instanceof LivingEntity)
|
||||
{
|
||||
if (((LivingEntity)entity).isCustomNameVisible() && ((LivingEntity)entity).getCustomName() != null)
|
||||
{
|
||||
if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("minekartrider"))
|
||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "Play " + ChatColor.YELLOW + "MineKart"));
|
||||
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("defek7"))
|
||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "defek7"));
|
||||
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("chiss"))
|
||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "Chiss"));
|
||||
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("Sterling_"))
|
||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "sterling_"));
|
||||
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("Spu_"))
|
||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "Spu_"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void PlayerJoin(PlayerJoinEvent event)
|
||||
|
@ -376,7 +431,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||
obj.getScore(Bukkit.getOfflinePlayer(C.cGray + C.Bold + "Latest News")).setScore(line--);
|
||||
player.getScoreboard().resetScores(Bukkit.getOfflinePlayer(Get(player).GetNewsText(false)));
|
||||
obj.getScore(Bukkit.getOfflinePlayer(Get(player).GetNewsText(true))).setScore(line--);
|
||||
*/
|
||||
*/
|
||||
|
||||
//Stacker
|
||||
obj.getScore(Bukkit.getOfflinePlayer(C.cGray + C.Bold + "Stacker")).setScore(line--);
|
||||
|
|
|
@ -739,7 +739,7 @@ public abstract class Game implements Listener
|
|||
|
||||
public boolean CanJoinTeam(GameTeam team)
|
||||
{
|
||||
return team.GetSize() < UtilServer.getPlayers().length/GetTeamList().size();
|
||||
return team.GetSize() < Math.max(1, UtilServer.getPlayers().length/GetTeamList().size());
|
||||
}
|
||||
|
||||
public GameTeam GetTeamPreference(Player player)
|
||||
|
|
|
@ -162,6 +162,9 @@ public class SuperSmash extends SoloGame
|
|||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void FallDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetCause() == DamageCause.FALL)
|
||||
event.SetCancelled("No Fall Damage");
|
||||
}
|
||||
|
@ -169,8 +172,18 @@ public class SuperSmash extends SoloGame
|
|||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void Knockback(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetDamageePlayer() != null)
|
||||
event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth()));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void ArenaWalls(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetCause() == DamageCause.VOID || event.GetCause() == DamageCause.LAVA)
|
||||
{
|
||||
|
|
|
@ -141,7 +141,7 @@ public class GameManager implements Listener
|
|||
if (game.GetCountdown() == -1)
|
||||
{
|
||||
game.InformQueuePositions();
|
||||
game.AnnounceGame();
|
||||
//game.AnnounceGame();
|
||||
}
|
||||
|
||||
//Initialise Countdown
|
||||
|
|
Loading…
Reference in New Issue