Game Lobby/Playwire/Command Fixes (#223)
* Tweak team locations to accommodate MPS' Disable certain commands from being used. * Change PlayWire things. * Update MPS locations. * Update. * Remove debug * Remove debug. Ty Sam
This commit is contained in:
parent
9d6985ddcd
commit
7d4c817856
@ -1,16 +1,19 @@
|
||||
package mineplex.core.command;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CommandCenter implements Listener
|
||||
{
|
||||
public static CommandCenter Instance;
|
||||
@ -18,7 +21,9 @@ public class CommandCenter implements Listener
|
||||
protected JavaPlugin Plugin;
|
||||
protected CoreClientManager ClientManager;
|
||||
protected static NautHashMap<String, ICommand> Commands;
|
||||
|
||||
private final List<String> BLOCKED_COMMANDS = Lists.newArrayList("pl", "plugins", "ver", "version", "icanhasbukkit");
|
||||
private final String MESSAGE = C.cRed + "I''m sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error.";
|
||||
|
||||
public static void Initialize(JavaPlugin plugin)
|
||||
{
|
||||
if (Instance == null)
|
||||
@ -53,7 +58,14 @@ public class CommandCenter implements Listener
|
||||
commandName = commandName.split(" ")[0];
|
||||
args = event.getMessage().substring(event.getMessage().indexOf(' ') + 1).split(" ");
|
||||
}
|
||||
|
||||
|
||||
if(BLOCKED_COMMANDS.contains(commandName.toLowerCase()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().sendMessage(MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
ICommand command = Commands.get(commandName.toLowerCase());
|
||||
|
||||
if (command != null)
|
||||
|
@ -22,7 +22,7 @@ import java.util.UUID;
|
||||
public class PlayWireManager extends MiniDbClientPlugin<PlayWireClientData>
|
||||
{
|
||||
|
||||
private final long COOL_DOWN = TimeUnit.HOURS.getMilliseconds() * 12;
|
||||
private final long COOL_DOWN = TimeUnit.HOURS.getMilliseconds();
|
||||
private static final int REWARD_MESSAGE_DELAY_SECONDS = 10;
|
||||
|
||||
private final DonationManager _donationManager;
|
||||
@ -72,7 +72,7 @@ public class PlayWireManager extends MiniDbClientPlugin<PlayWireClientData>
|
||||
|
||||
_repository.attemptPlayWire(player, client, () ->
|
||||
{
|
||||
_donationManager.RewardCoinsLater("Watching Ad", player, 250);
|
||||
_donationManager.RewardCoinsLater("Watching Ad", player, 100);
|
||||
Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, ResponseType.COUNTED.getMessage()), REWARD_MESSAGE_DELAY_SECONDS * 20L);
|
||||
});
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package nautilus.game.arcade;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.PlayerSelector;
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
@ -18,7 +17,6 @@ import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilLambda;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
@ -68,8 +66,6 @@ import mineplex.core.teleport.Teleport;
|
||||
import mineplex.core.thank.ThankManager;
|
||||
import mineplex.core.timing.TimingManager;
|
||||
import mineplex.core.titangiveaway.TitanGiveawayManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.valentines.ValentinesGiftManager;
|
||||
import mineplex.core.youtube.YoutubeManager;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClassManager;
|
||||
@ -1960,22 +1956,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void teleportPlayersToSpawn(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTEST)
|
||||
return;
|
||||
|
||||
PlayerSelector
|
||||
.selectPlayers(
|
||||
UtilLambda.and(
|
||||
PlayerSelector.inWorld(Bukkit.getWorld("world")),
|
||||
UtilLambda.not(PlayerSelector.within(GetLobby().getSpawn(), 70))
|
||||
)
|
||||
)
|
||||
.forEach(player -> player.teleport(GetLobby().getSpawn()));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void clearGameTeams(GameStateChangeEvent event)
|
||||
{
|
||||
|
@ -1,12 +1,14 @@
|
||||
package nautilus.game.arcade.managers.lobby;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import mineplex.core.PlayerSelector;
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilBlockText;
|
||||
import mineplex.core.common.util.UtilBlockText.TextAlign;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilLambda;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
@ -126,6 +128,11 @@ public abstract class LobbyManager implements Listener
|
||||
|
||||
public abstract void createKits(Game game);
|
||||
|
||||
public boolean isMPS()
|
||||
{
|
||||
return _manager.GetHost() != null;
|
||||
}
|
||||
|
||||
public void writeGameLine(String text, int line, int id, byte data)
|
||||
{
|
||||
Location loc = new Location(_gameText.getWorld(), _gameText.getX(), _gameText.getY(), _gameText.getZ());
|
||||
@ -243,6 +250,8 @@ public abstract class LobbyManager implements Listener
|
||||
if (event.getType() == UpdateType.FASTEST)
|
||||
{
|
||||
UpdateFirework();
|
||||
PlayerSelector.selectPlayers(UtilLambda.and(PlayerSelector.inWorld(Bukkit.getWorld("world")), UtilLambda.not(PlayerSelector.within(getSpawn(), 100))))
|
||||
.forEach(player -> player.teleport(getSpawn()));
|
||||
}
|
||||
|
||||
if (event.getType() == UpdateType.SLOW)
|
||||
|
@ -11,6 +11,7 @@ import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.deathtag.DeathTag;
|
||||
import nautilus.game.arcade.game.games.hideseek.HideSeek;
|
||||
import nautilus.game.arcade.game.games.smash.SuperSmash;
|
||||
import nautilus.game.arcade.game.games.wither.WitherGame;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
@ -52,8 +53,7 @@ public class NewGameLobbyManager extends LobbyManager
|
||||
{
|
||||
CARL,
|
||||
AMP,
|
||||
SPAWN,
|
||||
;
|
||||
SPAWN,;
|
||||
}
|
||||
|
||||
private final File CONFIG = new File("world/WorldConfig.dat");
|
||||
@ -67,7 +67,7 @@ public class NewGameLobbyManager extends LobbyManager
|
||||
super(manager, null, null, null);
|
||||
_run = CONFIG.exists();
|
||||
|
||||
if(_run)
|
||||
if (_run)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -90,7 +90,7 @@ public class NewGameLobbyManager extends LobbyManager
|
||||
{
|
||||
TimingManager.start("TeamGen");
|
||||
|
||||
if(!_run)
|
||||
if (!_run)
|
||||
{
|
||||
System.out.println("Cannot generate teams, no WorldConfig.dat file was found, but a NEW.dat file was. If this is a testing server, feel free to ignore this message.");
|
||||
return;
|
||||
@ -100,35 +100,35 @@ public class NewGameLobbyManager extends LobbyManager
|
||||
List<Location> locations = _multipleLocs.get("TEAM");
|
||||
boolean doShift = true;
|
||||
|
||||
if(locations == null)
|
||||
if (locations == null)
|
||||
{
|
||||
locations = Lists.newArrayList();
|
||||
for(GameTeam team : game.GetTeamList())
|
||||
for (GameTeam team : game.GetTeamList())
|
||||
{
|
||||
String name = team.GetName().toUpperCase() + "_SHEEP";
|
||||
|
||||
if(team.GetName().equalsIgnoreCase("Hiders"))
|
||||
if (team.GetName().equalsIgnoreCase("Hiders"))
|
||||
{
|
||||
name = "RED_SHEEP";
|
||||
}
|
||||
if(team.GetName().equalsIgnoreCase("Hunters"))
|
||||
if (team.GetName().equalsIgnoreCase("Hunters"))
|
||||
{
|
||||
name = "BLUE_SHEEP";
|
||||
}
|
||||
|
||||
if(team.GetName().equalsIgnoreCase("Withers"))
|
||||
if (team.GetName().equalsIgnoreCase("Withers"))
|
||||
{
|
||||
name = "RED_SHEEP";
|
||||
}
|
||||
|
||||
if(team.GetName().equalsIgnoreCase("Humans"))
|
||||
if (team.GetName().equalsIgnoreCase("Humans"))
|
||||
{
|
||||
name = "GREEN_SHEEP";
|
||||
}
|
||||
|
||||
Location location = _singleLocs.get(name);
|
||||
|
||||
if(location == null)
|
||||
if (location == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -139,15 +139,15 @@ public class NewGameLobbyManager extends LobbyManager
|
||||
}
|
||||
}
|
||||
|
||||
if(locations.size() == 0)
|
||||
if (locations.size() == 0)
|
||||
{
|
||||
System.out.println("Size is 0!");
|
||||
return;
|
||||
}
|
||||
|
||||
int shift = 0;
|
||||
float yaw = 90;
|
||||
|
||||
if(doShift)
|
||||
if (doShift)
|
||||
{
|
||||
if (list.size() == 2)
|
||||
{
|
||||
@ -160,46 +160,42 @@ public class NewGameLobbyManager extends LobbyManager
|
||||
}
|
||||
}
|
||||
|
||||
if(game instanceof DeathTag && isGeneratePodiums())
|
||||
if (game instanceof DeathTag && isGeneratePodiums())
|
||||
{
|
||||
int size = list.size();
|
||||
for(int i = 1; i < size; i++)
|
||||
for (int i = 1; i < size; i++)
|
||||
{
|
||||
list.remove(i);
|
||||
}
|
||||
}
|
||||
|
||||
if(game instanceof HideSeek)
|
||||
if (game instanceof HideSeek)
|
||||
{
|
||||
Collections.reverse(list);
|
||||
}
|
||||
|
||||
for(int i = 0; i < list.size(); i++)
|
||||
if (isMPS())
|
||||
{
|
||||
yaw = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < list.size(); i++)
|
||||
{
|
||||
GameTeam team = list.get(i);
|
||||
Location entLoc = locations.get(i).clone().add(0, 0, shift);
|
||||
entLoc.setYaw(90);
|
||||
Location entLoc = locations.get(i).clone();
|
||||
|
||||
entLoc.getChunk().load();
|
||||
|
||||
if(isGeneratePodiums())
|
||||
if (isMPS())
|
||||
{
|
||||
generatePodium(entLoc, team.GetColorData(), getTeamBlocks());
|
||||
entLoc.add(shift, 0, 0);
|
||||
} else
|
||||
{
|
||||
entLoc.add(0, 0, shift);
|
||||
}
|
||||
|
||||
Sheep ent = (Sheep) _manager.GetCreature().SpawnEntity(entLoc, EntityType.SHEEP);
|
||||
ent.setRemoveWhenFarAway(false);
|
||||
ent.setCustomNameVisible(true);
|
||||
entLoc.setYaw(yaw);
|
||||
|
||||
ent.setColor(DyeColor.getByWoolData(team.GetColorData()));
|
||||
|
||||
UtilEnt.Vegetate(ent, true);
|
||||
UtilEnt.setFakeHead(ent, true);
|
||||
UtilEnt.ghost(ent, true, false);
|
||||
|
||||
team.SetTeamEntity(ent);
|
||||
|
||||
getTeams().put(ent, new LobbyEnt(ent, entLoc, team));
|
||||
entLoc.getChunk().load();
|
||||
spawnTeamSheep(entLoc, team);
|
||||
}
|
||||
TimingManager.stop("TeamGen");
|
||||
}
|
||||
@ -209,7 +205,7 @@ public class NewGameLobbyManager extends LobbyManager
|
||||
{
|
||||
TimingManager.start("KitGen");
|
||||
|
||||
if(!_run)
|
||||
if (!_run)
|
||||
{
|
||||
System.out.println("Cannot generate kits, no WorldConfig.dat file was found, but a NEW.dat file was. If this is a testing server, feel free to ignore this message.");
|
||||
return;
|
||||
@ -238,7 +234,7 @@ public class NewGameLobbyManager extends LobbyManager
|
||||
|
||||
if (locations == null || locations.size() <= 1)
|
||||
{
|
||||
for(Kit kit : kitList)
|
||||
for (Kit kit : kitList)
|
||||
{
|
||||
String name = kit.GetName().toUpperCase().replace(" ", "_");
|
||||
Location entLoc = _singleLocs.get(name);
|
||||
@ -248,38 +244,127 @@ public class NewGameLobbyManager extends LobbyManager
|
||||
{
|
||||
int shift = 0;
|
||||
|
||||
if(!(game instanceof DeathTag) && !(game instanceof WitherGame))
|
||||
if (!(game instanceof DeathTag) && !(game instanceof WitherGame))
|
||||
{
|
||||
Collections.sort(kitList, new KitSorter());
|
||||
}
|
||||
|
||||
if(kitList.size() == 3)
|
||||
if (kitList.size() == 3)
|
||||
{
|
||||
shift = 4;
|
||||
}
|
||||
|
||||
if(kitList.size() == 1)
|
||||
if (kitList.size() == 1)
|
||||
{
|
||||
shift = 6;
|
||||
}
|
||||
|
||||
if(kitList.size() == 2)
|
||||
if (kitList.size() == 2)
|
||||
{
|
||||
shift = 2;
|
||||
}
|
||||
|
||||
if(kitList.size() == 4)
|
||||
if (kitList.size() == 4)
|
||||
{
|
||||
shift = 2;
|
||||
}
|
||||
|
||||
for(int i = 0; i < kitList.size(); i++)
|
||||
if (isMPS())
|
||||
{
|
||||
Location blank = new Location(WORLD, -1, -1, -1);
|
||||
|
||||
List<Location> buffer = Lists.newArrayList(locations);
|
||||
List<Location> removedPos = Lists.newArrayList();
|
||||
List<Location> removedNeg = Lists.newArrayList();
|
||||
|
||||
for (int i = 0; i < locations.size(); i++)
|
||||
{
|
||||
Location location = locations.get(i);
|
||||
|
||||
if (location.getBlockX() == -17)
|
||||
{
|
||||
buffer.set(i, blank);
|
||||
removedNeg.add(location);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Collections.reverse(removedNeg);
|
||||
|
||||
for (int i = 0; i < buffer.size(); i++)
|
||||
{
|
||||
Location locIn = buffer.get(i);
|
||||
|
||||
if (!locIn.equals(blank))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!removedNeg.isEmpty())
|
||||
{
|
||||
Location locOut = removedNeg.remove(0);
|
||||
buffer.set(i, locOut);
|
||||
}
|
||||
}
|
||||
|
||||
if (game instanceof SuperSmash)
|
||||
{
|
||||
for (int i = 0; i < locations.size(); i++)
|
||||
{
|
||||
Location location = locations.get(i);
|
||||
|
||||
if (location.getBlockX() == 17)
|
||||
{
|
||||
buffer.set(i, blank);
|
||||
removedPos.add(location);
|
||||
}
|
||||
}
|
||||
|
||||
Collections.reverse(removedPos);
|
||||
|
||||
for (int i = 0; i < buffer.size(); i++)
|
||||
{
|
||||
Location locIn = buffer.get(i);
|
||||
|
||||
if (!locIn.equals(blank))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!removedPos.isEmpty())
|
||||
{
|
||||
Location locOut = removedPos.remove(0);
|
||||
buffer.set(i, locOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
removedNeg.clear();
|
||||
removedPos.clear();
|
||||
|
||||
locations = buffer;
|
||||
}
|
||||
|
||||
for (int i = 0; i < kitList.size(); i++)
|
||||
{
|
||||
Kit kit = kitList.get(i);
|
||||
int index = shift == 0 ? i : (locations.size() - 1) - i;
|
||||
Location entLoc = locations.get(index).clone().subtract(0, 0, shift);
|
||||
|
||||
if(isGeneratePodiums())
|
||||
if (isMPS())
|
||||
{
|
||||
index = i;
|
||||
}
|
||||
|
||||
Location entLoc = locations.get(index);
|
||||
|
||||
if (entLoc == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
entLoc.clone().subtract(0, 0, shift);
|
||||
|
||||
if (isGeneratePodiums())
|
||||
{
|
||||
byte data = 4;
|
||||
|
||||
@ -300,6 +385,28 @@ public class NewGameLobbyManager extends LobbyManager
|
||||
TimingManager.stop("KitGen");
|
||||
}
|
||||
|
||||
private void spawnTeamSheep(Location entLoc, GameTeam team)
|
||||
{
|
||||
if (isGeneratePodiums())
|
||||
{
|
||||
generatePodium(entLoc, team.GetColorData(), getTeamBlocks());
|
||||
}
|
||||
|
||||
Sheep ent = (Sheep) _manager.GetCreature().SpawnEntity(entLoc, EntityType.SHEEP);
|
||||
ent.setRemoveWhenFarAway(false);
|
||||
ent.setCustomNameVisible(true);
|
||||
|
||||
ent.setColor(DyeColor.getByWoolData(team.GetColorData()));
|
||||
|
||||
UtilEnt.Vegetate(ent, true);
|
||||
UtilEnt.setFakeHead(ent, true);
|
||||
UtilEnt.ghost(ent, true, false);
|
||||
|
||||
team.SetTeamEntity(ent);
|
||||
|
||||
getTeams().put(ent, new LobbyEnt(ent, entLoc, team));
|
||||
}
|
||||
|
||||
private void generatePodium(Location loc, byte data, Map<Block, Material> blocks)
|
||||
{
|
||||
Location location = loc.clone();
|
||||
@ -308,9 +415,9 @@ public class NewGameLobbyManager extends LobbyManager
|
||||
int z = location.getBlockZ();
|
||||
|
||||
//Steps
|
||||
for(int modX = x - 1; modX <= x + 1; modX++)
|
||||
for (int modX = x - 1; modX <= x + 1; modX++)
|
||||
{
|
||||
for(int modZ = z -1; modZ <= z + 1; modZ++)
|
||||
for (int modZ = z - 1; modZ <= z + 1; modZ++)
|
||||
{
|
||||
Location temp = new Location(location.getWorld(), modX, y, modZ);
|
||||
Block block = temp.getBlock();
|
||||
@ -320,9 +427,9 @@ public class NewGameLobbyManager extends LobbyManager
|
||||
}
|
||||
|
||||
//Wool
|
||||
for(int modX = x - 1; modX <= x + 1; modX++)
|
||||
for (int modX = x - 1; modX <= x + 1; modX++)
|
||||
{
|
||||
for(int modY = y -1; modY < y; modY++)
|
||||
for (int modY = y - 1; modY < y; modY++)
|
||||
{
|
||||
for (int modZ = z - 1; modZ <= z + 1; modZ++)
|
||||
{
|
||||
@ -337,9 +444,8 @@ public class NewGameLobbyManager extends LobbyManager
|
||||
|
||||
private void setKit(Kit kit, Location entLoc)
|
||||
{
|
||||
if(entLoc == null)
|
||||
if (entLoc == null)
|
||||
{
|
||||
System.out.println("Null ent loc for " + kit.GetName());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -349,11 +455,16 @@ public class NewGameLobbyManager extends LobbyManager
|
||||
|
||||
float yaw = 90;
|
||||
|
||||
if(yawLoc.getBlockX() < 0)
|
||||
if (yawLoc.getBlockX() < 0)
|
||||
{
|
||||
yaw = 270;
|
||||
}
|
||||
|
||||
if (yawLoc.getBlockZ() == 13)
|
||||
{
|
||||
yaw = 180;
|
||||
}
|
||||
|
||||
entLoc.setYaw(yaw);
|
||||
|
||||
Entity ent = kit.SpawnEntity(entLoc);
|
||||
|
Loading…
Reference in New Issue
Block a user