Merge branch 'Bonus' of http://184.154.0.242:7990/scm/min/mineplex into Bonus
This commit is contained in:
commit
be699558f1
@ -2,6 +2,8 @@ package mineplex.core.bonuses;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
|
||||
public class BonusAmount
|
||||
@ -138,6 +140,7 @@ public class BonusAmount
|
||||
|
||||
public void addLore(List<String> lore)
|
||||
{
|
||||
lore.add(C.cYellow + "Rewards");
|
||||
addLore(lore, getTickets(), 0, "Carl Spin Ticket" + (getTickets() > 1 ? "s" : ""));
|
||||
addLore(lore, getCoins(), getBonusCoins(), "Coins");
|
||||
addLore(lore, getGems(), getBonusGems(), "Gems");
|
||||
@ -148,7 +151,7 @@ public class BonusAmount
|
||||
private void addLore(List<String> lore, int amount, int bonus, String suffix)
|
||||
{
|
||||
if (amount > 0)
|
||||
lore.add(C.cYellow + "Reward: " + C.cWhite + amount + " " + suffix);
|
||||
lore.add(" " + C.cWhite + amount + " " + suffix);
|
||||
|
||||
// if (bonus > 0)
|
||||
// lore.add(C.cYellow + "Streak Bonus: " + C.cWhite + bonus + " " + suffix);
|
||||
|
@ -12,6 +12,8 @@ import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.IQuerylessLoginProcessor;
|
||||
import mineplex.core.account.event.ClientUnloadEvent;
|
||||
import mineplex.core.bonuses.redis.VoteHandler;
|
||||
import mineplex.core.bonuses.redis.VotifierCommand;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
@ -34,7 +36,6 @@ import mineplex.core.reward.RewardManager;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.votifier.VotifierCommand;
|
||||
import mineplex.database.Tables;
|
||||
import mineplex.core.bonuses.animations.AnimationCarl;
|
||||
import mineplex.core.bonuses.commands.AnimationCommand;
|
||||
@ -52,7 +53,6 @@ import org.jooq.impl.DSL;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Dropper;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Item;
|
||||
@ -61,7 +61,6 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.DataWatcher;
|
||||
@ -107,7 +106,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
@Override
|
||||
public void run(Long data)
|
||||
{
|
||||
System.out.println("Sql time offset is: " + data);
|
||||
timeOffSet = data;
|
||||
}
|
||||
});
|
||||
@ -211,7 +209,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
{
|
||||
if (event.getType() != UpdateType.MIN_16)
|
||||
return;
|
||||
System.err.println("Updating off set");
|
||||
updateOffSet();
|
||||
}
|
||||
|
||||
@ -255,7 +252,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
return _voteStreak;
|
||||
}
|
||||
|
||||
public void handleVote(final Player player)
|
||||
public void handleVote(final Player player, final int gemsRecieved)
|
||||
{
|
||||
runAsync(new Runnable()
|
||||
{
|
||||
@ -270,7 +267,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
{
|
||||
addPendingExplosion(player, player.getName());
|
||||
UtilPlayer.message(player, F.main("Carl", "Thanks for voting for Mineplex!"));
|
||||
UtilPlayer.message(player, F.main("Carl", "You received 500 Gems and 1 Carls Spinner Ticket!"));
|
||||
UtilPlayer.message(player, F.main("Carl", "You received " + gemsRecieved + " Gems and 1 Carl Spinner Ticket!"));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -378,7 +375,8 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
// DAILY BONUS
|
||||
|
||||
public static final long TIME_BETWEEN_BONUSES = 1000 * 60 * 60 * 20;
|
||||
public static final long STREAK_RESET_TIME = 1000 * 60 * 60 * 12;
|
||||
public static final long DAILY_STREAK_RESET_TIME = 1000 * 60 * 60 * 12;
|
||||
public static final long VOTE_STREAK_RESET_TIME = 1000 * 60 * 60 * 24;
|
||||
|
||||
public void attemptDailyBonus(final Player player, final BonusAmount amount, final Callback<Boolean> result)
|
||||
{
|
||||
@ -499,7 +497,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
if (client.getDailyStreak() > 0 && client.getDailyTime() != null)
|
||||
{
|
||||
long lastBonus = getLocalTime(client.getDailyTime().getTime());
|
||||
long timeLeft = getStreakTimeRemaining(lastBonus, BonusManager.STREAK_RESET_TIME);
|
||||
long timeLeft = getStreakTimeRemaining(lastBonus, BonusManager.DAILY_STREAK_RESET_TIME);
|
||||
|
||||
if (timeLeft < 0)
|
||||
{
|
||||
@ -508,6 +506,25 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
}
|
||||
}
|
||||
|
||||
public void updateVoteStreak(Player player)
|
||||
{
|
||||
updateVoteStreak(Get(player));
|
||||
}
|
||||
|
||||
public void updateVoteStreak(BonusClientData client)
|
||||
{
|
||||
if (client.getVoteStreak() > 0 && client.getVoteTime() != null)
|
||||
{
|
||||
long lastBonus = getLocalTime(client.getDailyTime().getTime());
|
||||
long timeLeft = getStreakTimeRemaining(lastBonus, BonusManager.VOTE_STREAK_RESET_TIME);
|
||||
|
||||
if (timeLeft < 0)
|
||||
{
|
||||
client.setVoteStreak(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void incrementDailyStreak(Player player)
|
||||
{
|
||||
BonusClientData data = Get(player);
|
||||
@ -669,6 +686,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
|
||||
if (gems > 0)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(gems + " Gems")));
|
||||
_donationManager.RewardGems(new Callback<Boolean>()
|
||||
{
|
||||
@Override
|
||||
@ -676,18 +694,18 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
{
|
||||
if (data)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(gems + " Gems")));
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Carl", "Failed to process Gems"));
|
||||
}
|
||||
}
|
||||
}, "BonusManager", player.getName(), player.getUniqueId(), gems, true);
|
||||
}, "Earned", player.getName(), player.getUniqueId(), gems, true);
|
||||
}
|
||||
|
||||
if (gold > 0)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(gold + " Gold")));
|
||||
_donationManager.RewardGold(new Callback<Boolean>()
|
||||
{
|
||||
@Override
|
||||
@ -695,18 +713,18 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
{
|
||||
if (data)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(gold + " Gold")));
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Carl", "Failed to process Gold"));
|
||||
}
|
||||
}
|
||||
}, "BonusManager", player.getName(), coreClient.getAccountId(), gold, true);
|
||||
}, "Earned", player.getName(), coreClient.getAccountId(), gold, true);
|
||||
}
|
||||
|
||||
if (coins > 0)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(coins + " Coins")));
|
||||
_donationManager.RewardCoins(new Callback<Boolean>()
|
||||
{
|
||||
@Override
|
||||
@ -714,18 +732,18 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
{
|
||||
if (data)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(coins + " Coins")));
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Carl", "Failed to process Coins"));
|
||||
}
|
||||
}
|
||||
}, "BonusManager", player.getName(), coreClient.getAccountId(), coins, true);
|
||||
}, "Earned", player.getName(), coreClient.getAccountId(), coins, true);
|
||||
}
|
||||
|
||||
if (tickets > 0)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(tickets + " Carl Spin Ticket")));
|
||||
final int accountId = _clientManager.Get(player).getAccountId();
|
||||
runAsync(new Runnable()
|
||||
{
|
||||
@ -742,7 +760,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
public void run()
|
||||
{
|
||||
bonusClient.setTickets(newTickets);
|
||||
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(tickets + " Carl Spin Ticket")));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -760,7 +777,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
_statsManager.incrementStat(player, "Global.ExpEarned", experience);
|
||||
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(experience + " Experience")));
|
||||
}
|
||||
|
||||
|
||||
UtilPlayer.message(player, F.main("Carl", "Come back tomorrow for more!"));
|
||||
|
||||
}
|
||||
@ -900,15 +917,16 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
@EventHandler
|
||||
public void updateCreeper(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC || !_enabled)
|
||||
if (event.getType() != UpdateType.FASTER || !_enabled)
|
||||
return;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
String prefix = _visualTick % 2 == 0 ? C.cAqua : C.cDAqua;
|
||||
updateCreeperVisual(player, false, prefix);
|
||||
_visualTick++;
|
||||
}
|
||||
|
||||
_visualTick++;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -289,9 +289,8 @@ public class BonusRepository extends RepositoryBase
|
||||
});
|
||||
}
|
||||
|
||||
public void attemptVoteBonus(final Player player, final Callback<Boolean> result)
|
||||
public void attemptVoteBonus(final int accountId, final Callback<Date> result)
|
||||
{
|
||||
final int accountId = _manager.getClientManager().Get(player).getAccountId();
|
||||
final int coins = 0;
|
||||
final int gems = 0;
|
||||
|
||||
@ -312,23 +311,23 @@ public class BonusRepository extends RepositoryBase
|
||||
|
||||
callableStatement.executeUpdate();
|
||||
|
||||
//final boolean pass = callableStatement.getBoolean(4);
|
||||
final boolean pass = callableStatement.getBoolean(4);
|
||||
|
||||
final Date date = callableStatement.getDate(4);
|
||||
final Date date = callableStatement.getDate(5);
|
||||
|
||||
Bukkit.getScheduler().runTask(plug, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_manager.Get(player).setVoteTime(date);
|
||||
result.run(true);
|
||||
// _manager.Get(player).setVoteTime(date);
|
||||
result.run(date);
|
||||
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
result.run(false);
|
||||
result.run(null);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -37,7 +37,6 @@ public class BonusGui extends SimpleGui
|
||||
@Override
|
||||
protected void finalize() throws Throwable
|
||||
{
|
||||
System.err.println("Deleting the MailboxGui!");
|
||||
super.finalize();
|
||||
}
|
||||
}
|
@ -144,7 +144,6 @@ public class SpinGui extends SimpleGui
|
||||
|
||||
if(_currentRewardIndex == _stopSpinnerAt)
|
||||
_stopped = true;
|
||||
|
||||
}
|
||||
|
||||
_tickCount++;
|
||||
|
@ -152,7 +152,7 @@ public class DailyBonusButton implements GuiItem, Listener
|
||||
if (client.getDailyTime() != null)
|
||||
{
|
||||
long lastBonus = _bonusManager.getLocalTime(client.getDailyTime().getTime());
|
||||
long timeLeft = _bonusManager.getStreakTimeRemaining(lastBonus, BonusManager.STREAK_RESET_TIME);
|
||||
long timeLeft = _bonusManager.getStreakTimeRemaining(lastBonus, BonusManager.DAILY_STREAK_RESET_TIME);
|
||||
|
||||
if (timeLeft > 0)
|
||||
{
|
||||
|
@ -135,7 +135,7 @@ public class VoteButton implements GuiItem, Listener {
|
||||
if (client.getVoteTime() != null)
|
||||
{
|
||||
long lastBonus = _bonusManager.getLocalTime(client.getVoteTime().getTime());
|
||||
long timeLeft = _bonusManager.getStreakTimeRemaining(lastBonus, BonusManager.STREAK_RESET_TIME);
|
||||
long timeLeft = _bonusManager.getStreakTimeRemaining(lastBonus, BonusManager.VOTE_STREAK_RESET_TIME);
|
||||
|
||||
if (timeLeft > 0)
|
||||
{
|
||||
@ -166,7 +166,6 @@ public class VoteButton implements GuiItem, Listener {
|
||||
{
|
||||
if (_url == null)
|
||||
return false;
|
||||
System.out.println(timeLeft());
|
||||
|
||||
return (timeLeft() <= 0);
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
package mineplex.core.bonuses;
|
||||
package mineplex.core.bonuses.redis;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.bonuses.BonusManager;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.votifier.VotifierCommand;
|
||||
import mineplex.serverdata.commands.CommandCallback;
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
@ -25,7 +25,7 @@ public class VoteHandler implements CommandCallback
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
_bonusManager.handleVote(player);
|
||||
_bonusManager.handleVote(player, v.getGemsReceived());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,18 +1,18 @@
|
||||
package mineplex.core.votifier;
|
||||
|
||||
import java.util.UUID;
|
||||
package mineplex.core.bonuses.redis;
|
||||
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
public class VotifierCommand extends ServerCommand
|
||||
{
|
||||
private String _playerName;
|
||||
private int _gemsReceived;
|
||||
|
||||
public VotifierCommand(String playerName, String... targetServer)
|
||||
public VotifierCommand(String playerName, int gemsReceived, String... targetServer)
|
||||
{
|
||||
super(targetServer);
|
||||
|
||||
_playerName = playerName;
|
||||
_gemsReceived = gemsReceived;
|
||||
}
|
||||
|
||||
public String getPlayerName()
|
||||
@ -20,4 +20,9 @@ public class VotifierCommand extends ServerCommand
|
||||
return _playerName;
|
||||
}
|
||||
|
||||
public int getGemsReceived()
|
||||
{
|
||||
return _gemsReceived;
|
||||
}
|
||||
|
||||
}
|
@ -92,7 +92,7 @@ public class GadgetManager extends MiniPlugin
|
||||
addGadget(new ItemTNT(this));
|
||||
addGadget(new ItemMelonLauncher(this));
|
||||
addGadget(new ItemFleshHook(this));
|
||||
//addGadget(new ItemPaintballGun(this));
|
||||
addGadget(new ItemPaintballGun(this));
|
||||
addGadget(new ItemBatGun(this));
|
||||
addGadget(new ItemCoinBomb(this));
|
||||
addGadget(new ItemPaintbrush(this));
|
||||
|
@ -18,9 +18,15 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.event.GadgetBlockEvent;
|
||||
import mineplex.core.gadget.types.ItemGadget;
|
||||
@ -30,16 +36,17 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
public class ItemPaintballGun extends ItemGadget
|
||||
{
|
||||
private HashSet<Projectile> _balls = new HashSet<Projectile>();
|
||||
|
||||
public ItemPaintballGun(GadgetManager manager)
|
||||
|
||||
public ItemPaintballGun(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Paintball Gun", new String[]
|
||||
{
|
||||
super(manager, "Paintball Gun", new String[]
|
||||
{
|
||||
C.cWhite + "PEW PEW PEW PEW!",
|
||||
},
|
||||
-1,
|
||||
Material.GOLD_BARDING, (byte)0,
|
||||
200, new Ammo("Paintball Gun", "100 Paintballs", Material.GOLD_BARDING, (byte)0, new String[] { C.cWhite + "100 Paintballs for you to shoot!" }, 500, 100));
|
||||
}, -1, Material.GOLD_BARDING, (byte) 0, 200, new Ammo("Paintball Gun", "100 Paintballs", Material.GOLD_BARDING,
|
||||
(byte) 0, new String[]
|
||||
{
|
||||
C.cWhite + "100 Paintballs for you to shoot!"
|
||||
}, 500, 100));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -48,77 +55,56 @@ public class ItemPaintballGun extends ItemGadget
|
||||
Projectile proj = player.launchProjectile(EnderPearl.class);
|
||||
proj.setVelocity(proj.getVelocity().multiply(2));
|
||||
_balls.add(proj);
|
||||
|
||||
//Sound
|
||||
|
||||
// Sound
|
||||
player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1.5f, 1.2f);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void Paint(ProjectileHitEvent event)
|
||||
{
|
||||
if (!_balls.remove(event.getEntity()))
|
||||
return;
|
||||
|
||||
Location loc = event.getEntity().getLocation().add(event.getEntity().getVelocity());
|
||||
loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 49);
|
||||
|
||||
byte color = 2;
|
||||
double r = Math.random();
|
||||
if (r > 0.8) color = 4;
|
||||
else if (r > 0.6) color = 5;
|
||||
else if (r > 0.4) color = 9;
|
||||
else if (r > 0.2) color = 14;
|
||||
|
||||
for (Block block : UtilBlock.getInRadius(loc, 3d).keySet())
|
||||
Location loc = event.getEntity().getLocation();
|
||||
|
||||
Vector vec = event.getEntity().getVelocity().normalize().multiply(0.05);
|
||||
|
||||
if (vec.length() > 0)
|
||||
{
|
||||
if (block.getType() == Material.PORTAL)
|
||||
return;
|
||||
|
||||
if (block.getType() == Material.CACTUS)
|
||||
return;
|
||||
|
||||
if (block.getType() == Material.SUGAR_CANE_BLOCK)
|
||||
return;
|
||||
}
|
||||
|
||||
List<Block> blocks = new ArrayList<Block>();
|
||||
blocks.addAll(UtilBlock.getInRadius(loc, 1.5d).keySet());
|
||||
|
||||
GadgetBlockEvent gadgetEvent = new GadgetBlockEvent(this, blocks);
|
||||
Bukkit.getServer().getPluginManager().callEvent(gadgetEvent);
|
||||
|
||||
if (gadgetEvent.isCancelled())
|
||||
return;
|
||||
|
||||
for (Block block : gadgetEvent.getBlocks())
|
||||
{
|
||||
if (!UtilBlock.solid(block))
|
||||
continue;
|
||||
|
||||
if (block.getType() == Material.CARPET)
|
||||
Manager.getBlockRestore().Add(block, 171, color, 4000);
|
||||
else
|
||||
Manager.getBlockRestore().Add(block, 35, color, 4000);
|
||||
int i = 0;
|
||||
|
||||
while (UtilBlock.airFoliage(loc.getBlock()))
|
||||
{
|
||||
loc.add(vec);
|
||||
|
||||
if (i++ > 50)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
loc.getWorld().playSound(loc, Sound.DIG_STONE, 1.3F, 1.3F);
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.RED_DUST, loc, 0.2F, 0.2F, 0.2F, 1, 70, ViewDist.LONG, UtilServer.getPlayers());
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void Teleport(PlayerTeleportEvent event)
|
||||
{
|
||||
if (event.getCause() == TeleportCause.ENDER_PEARL)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void cleanupBalls(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SLOW)
|
||||
return;
|
||||
|
||||
|
||||
for (Iterator<Projectile> ballIterator = _balls.iterator(); ballIterator.hasNext();)
|
||||
{
|
||||
Projectile ball = ballIterator.next();
|
||||
|
||||
|
||||
if (ball.isDead() || !ball.isValid())
|
||||
ballIterator.remove();
|
||||
}
|
||||
|
@ -42,8 +42,8 @@ public class NotificationManager extends MiniPlugin
|
||||
if (!_enabled)
|
||||
return;
|
||||
|
||||
// if (event.getType() == UpdateType.MIN_08)
|
||||
// hugeSale();
|
||||
if (event.getType() == UpdateType.MIN_08)
|
||||
hugeSale();
|
||||
|
||||
// if (event.getType() == UpdateType.MIN_16)
|
||||
// sale();
|
||||
@ -95,17 +95,17 @@ public class NotificationManager extends MiniPlugin
|
||||
if (rank == Rank.ALL)
|
||||
{
|
||||
UtilPlayer.message(player, C.cWhite + " " + player.getName() + ", you can get 75% Off " + C.cAqua + C.Bold + "All Lifetime Ranks" + C.cWhite + "!");
|
||||
UtilPlayer.message(player, C.cWhite + " This is our biggest sale ever, available " + C.cRed + C.Line + "this weekend only" + C.cWhite + "!");
|
||||
UtilPlayer.message(player, C.cWhite + " This is our biggest sale ever, " + C.cRed + C.Line + "ends Sunday 16th" + C.cWhite + "!");
|
||||
}
|
||||
else if (rank == Rank.ULTRA)
|
||||
{
|
||||
UtilPlayer.message(player, C.cWhite + " Hello " + player.getName() + ", upgrade to " + C.cPurple + C.Bold + "HERO RANK" + C.cWhite + " for only $7.50!");
|
||||
UtilPlayer.message(player, C.cWhite + " This is our biggest sale ever, available " + C.cRed + C.Line + "this weekend only" + C.cWhite + "!");
|
||||
UtilPlayer.message(player, C.cWhite + " This is our biggest sale ever, " + C.cRed + C.Line + "ends Sunday 16th" + C.cWhite + "!");
|
||||
}
|
||||
else if (rank == Rank.HERO)
|
||||
{
|
||||
UtilPlayer.message(player, C.cWhite + " Hello " + player.getName() + ", upgrade to " + C.cGreen + C.Bold + "LEGEND RANK" + C.cWhite + " for only $7.50!");
|
||||
UtilPlayer.message(player, C.cWhite + " This is our biggest sale ever, available " + C.cRed + C.Line + "this weekend only" + C.cWhite + "!");
|
||||
UtilPlayer.message(player, C.cWhite + " This is our biggest sale ever, " + C.cRed + C.Line + "ends Sunday 16th" + C.cWhite + "!");
|
||||
}
|
||||
|
||||
UtilPlayer.message(player, " ");
|
||||
|
@ -17,12 +17,11 @@ import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.core.database.DBPool;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.votifier.VotifierCommand;
|
||||
import mineplex.core.bonuses.redis.VotifierCommand;
|
||||
import mineplex.database.Tables;
|
||||
import mineplex.serverdata.Region;
|
||||
import mineplex.serverdata.Utility;
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
import mineplex.serverdata.commands.ServerCommandManager;
|
||||
import mineplex.serverdata.data.PlayerStatus;
|
||||
import mineplex.serverdata.redis.RedisConfig;
|
||||
import mineplex.serverdata.redis.RedisDataRepository;
|
||||
@ -75,7 +74,7 @@ public class VotifierManager extends MiniPlugin
|
||||
public void handleVote(VotifierEvent event)
|
||||
{
|
||||
Vote vote = event.getVote();
|
||||
String playerName = vote.getUsername();
|
||||
final String playerName = vote.getUsername();
|
||||
|
||||
System.out.println("New Vote: " + playerName);
|
||||
|
||||
@ -93,7 +92,14 @@ public class VotifierManager extends MiniPlugin
|
||||
|
||||
System.out.println("Loaded " + playerName + " with uuid " + uuid);
|
||||
System.out.println("Attempting to award bonus");
|
||||
awardBonus(playerName, uuid);
|
||||
awardBonus(playerName, uuid, new Callback<Integer>()
|
||||
{
|
||||
@Override
|
||||
public void run(Integer gems)
|
||||
{
|
||||
notifyServer(playerName, gems, false);
|
||||
}
|
||||
});
|
||||
System.out.println();
|
||||
System.out.println();
|
||||
|
||||
@ -129,19 +135,18 @@ public class VotifierManager extends MiniPlugin
|
||||
// }
|
||||
|
||||
// Currently we just notify all servers, and the server with the player on it can deal with it
|
||||
notifyServer(playerName, false);
|
||||
// notifyServer(playerName, true);
|
||||
}
|
||||
|
||||
private void notifyServer(String playerName, boolean eu)
|
||||
private void notifyServer(String playerName, int gems, boolean eu)
|
||||
{
|
||||
JedisPool writePool = eu ? _euWritePool : _usWritePool;
|
||||
|
||||
VotifierCommand command = new VotifierCommand(playerName);
|
||||
VotifierCommand command = new VotifierCommand(playerName, gems);
|
||||
publishCommand(command, writePool);
|
||||
}
|
||||
|
||||
private void awardBonus(final String playerName, UUID uuid)
|
||||
private void awardBonus(final String playerName, UUID uuid, final Callback<Integer> onComplete)
|
||||
{
|
||||
DSLContext create = DSL.using(DBPool.ACCOUNT, SQLDialect.MYSQL);
|
||||
|
||||
@ -157,7 +162,7 @@ public class VotifierManager extends MiniPlugin
|
||||
if (amount.getTickets() > 0)
|
||||
client.setTickets(client.getTickets() + amount.getTickets());
|
||||
|
||||
if (amount.getGems() > 0)
|
||||
if (amount.getTotalGems() > 0)
|
||||
{
|
||||
_donationManager.RewardGems(new Callback<Boolean>()
|
||||
{
|
||||
@ -169,10 +174,10 @@ public class VotifierManager extends MiniPlugin
|
||||
else
|
||||
System.out.println("Failed to give " + amount.getGems() + " gems to " + playerName);
|
||||
}
|
||||
}, "Votifier", playerName, uuid, amount.getGems());
|
||||
}, "Votifier", playerName, uuid, amount.getTotalGems());
|
||||
}
|
||||
|
||||
if (amount.getCoins() > 0)
|
||||
if (amount.getTotalCoins() > 0)
|
||||
{
|
||||
_donationManager.RewardCoins(new Callback<Boolean>()
|
||||
{
|
||||
@ -184,17 +189,31 @@ public class VotifierManager extends MiniPlugin
|
||||
else
|
||||
System.out.println("Failed to give " + amount.getGems() + " coins to " + playerName);
|
||||
}
|
||||
}, "Votifier", playerName, accountId, amount.getCoins());
|
||||
}, "Votifier", playerName, accountId, amount.getTotalCoins());
|
||||
}
|
||||
|
||||
// Check if we need to reset vote streak
|
||||
_bonusManager.updateVoteStreak(client);
|
||||
|
||||
// Update time
|
||||
client.getRecord().setVotetime(new Date(_bonusManager.getSqlTime()));
|
||||
_bonusManager.getRepository().attemptVoteBonus(accountId, new Callback<Date>()
|
||||
{
|
||||
@Override
|
||||
public void run(Date data)
|
||||
{
|
||||
if (data != null)
|
||||
{
|
||||
client.getRecord().setVotetime(data);
|
||||
|
||||
// Update Streak
|
||||
_bonusManager.incrementVoteStreak(client);
|
||||
// Update Streak
|
||||
_bonusManager.incrementVoteStreak(client);
|
||||
|
||||
client.getRecord().store();
|
||||
System.out.println("Awarded carl ticket to " + playerName);
|
||||
client.getRecord().store();
|
||||
System.out.println("Awarded carl ticket to " + playerName);
|
||||
onComplete.run(amount.getTotalGems());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -854,8 +854,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
{
|
||||
// Give developers operator on their servers
|
||||
boolean testServer = _plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
|
||||
|
||||
if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.OWNER) || (testServer && (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.DEVELOPER) || _clientManager.Get(event.getPlayer()).GetRank() == Rank.JNR_DEV)))
|
||||
boolean eventTestServer = _plugin.getConfig().getString("serverstatus.name").equalsIgnoreCase("SMTestServer-1");
|
||||
|
||||
if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.OWNER)
|
||||
|| (testServer && (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.DEVELOPER) || _clientManager.Get(event.getPlayer()).GetRank() == Rank.JNR_DEV))
|
||||
|| eventTestServer && _clientManager.Get(event.getPlayer()).GetRank().Has(Rank.JNR_DEV))
|
||||
event.getPlayer().setOp(true);
|
||||
else
|
||||
event.getPlayer().setOp(false);
|
||||
|
@ -82,7 +82,11 @@ public class EventModule extends MiniPlugin
|
||||
if (!event.getMessage().toLowerCase().startsWith("/sethost "))
|
||||
return;
|
||||
|
||||
if (!Manager.GetClients().Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.JNR_DEV, true))
|
||||
boolean eventTestServer = _plugin.getConfig().getString("serverstatus.name").equalsIgnoreCase("SMTestServer-1");
|
||||
|
||||
if (!Manager.GetClients().Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.JNR_DEV, true)
|
||||
&& !event.getPlayer().isOp() &&
|
||||
(!eventTestServer && !Manager.GetClients().Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.SNR_MODERATOR, true)))
|
||||
return;
|
||||
|
||||
Manager.GetServerConfig().HostName = event.getMessage().split(" ")[1];
|
||||
@ -177,7 +181,9 @@ public class EventModule extends MiniPlugin
|
||||
if (!event.getMessage().toLowerCase().startsWith("/e "))
|
||||
return;
|
||||
|
||||
if(!Manager.GetGameHostManager().isEventServer())
|
||||
boolean eventTestServer = _plugin.getConfig().getString("serverstatus.name").equalsIgnoreCase("SMTestServer-1");
|
||||
|
||||
if(!Manager.GetGameHostManager().isEventServer() && !eventTestServer)
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
@ -89,10 +89,10 @@ public class MenuPage extends BasePage
|
||||
if (host)
|
||||
{
|
||||
GiveAdminButton giveAdminButton = new GiveAdminButton(getPlugin(), getShop());
|
||||
addButton(4 + 9, new ShopItem(Material.DIAMOND_SWORD, "Give Admin", new String[]{}, 1, false), giveAdminButton);
|
||||
addButton(4 + 9, new ShopItem(Material.DIAMOND_SWORD, "Give Co-Host", new String[]{}, 1, false), giveAdminButton);
|
||||
|
||||
RemoveAdminButton removeAdminButton = new RemoveAdminButton(getPlugin(), getShop());
|
||||
addButton(4 + 18, new ShopItem(Material.GOLD_SWORD, "Remove Admin", new String[]{}, 1, false), removeAdminButton);
|
||||
addButton(4 + 18, new ShopItem(Material.GOLD_SWORD, "Remove Co-Host", new String[]{}, 1, false), removeAdminButton);
|
||||
|
||||
KillButton killButton = new KillButton(getPlugin());
|
||||
addButton(8 + 18, new ShopItem(Material.TNT, "Kill Private Server",
|
||||
|
@ -90,9 +90,9 @@ public class GameChatManager implements Listener
|
||||
else if (Manager.GetGameHostManager().isAdmin(event.getPlayer(), false))
|
||||
{
|
||||
if (Manager.GetGameHostManager().isEventServer())
|
||||
rankStr = C.cDGreen + C.Bold + "Event Admin ";
|
||||
rankStr = C.cDGreen + C.Bold + "Event Co-Host ";
|
||||
else
|
||||
rankStr = C.cDGreen + C.Bold + "MPS Admin ";
|
||||
rankStr = C.cDGreen + C.Bold + "MPS Co-Host ";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -230,6 +230,10 @@ public class GameHostManager implements Listener
|
||||
_hostRank = Manager.GetClients().Get(_host).GetRank();
|
||||
System.out.println("Game Host Joined.");
|
||||
|
||||
//Limit player count!
|
||||
if (Manager.GetServerConfig().MaxPlayers > getMaxPlayerCap())
|
||||
Manager.GetServerConfig().MaxPlayers = getMaxPlayerCap();
|
||||
|
||||
if (isEventServer())
|
||||
worldeditPermissionSet(event.getPlayer(), true);
|
||||
}
|
||||
@ -374,7 +378,7 @@ public class GameHostManager implements Listener
|
||||
if (!isPrivateServer())
|
||||
return;
|
||||
|
||||
if (!Manager.GetClients().Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.JNR_DEV, true))
|
||||
if (!Manager.GetClients().Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.JNR_DEV, true) && !event.getPlayer().isOp())
|
||||
return;
|
||||
|
||||
giveAdmin(event.getPlayer());
|
||||
@ -642,7 +646,7 @@ public class GameHostManager implements Listener
|
||||
{
|
||||
_adminList.add(player.getName());
|
||||
_onlineAdmins.add(player);
|
||||
UtilPlayer.message(player, F.main("Server", "You were given admin privileges."));
|
||||
UtilPlayer.message(player, F.main("Server", "You were given Co-Host privileges."));
|
||||
|
||||
if (isEventServer())
|
||||
worldeditPermissionSet(player, true);
|
||||
@ -660,7 +664,7 @@ public class GameHostManager implements Listener
|
||||
{
|
||||
player.closeInventory();
|
||||
}
|
||||
UtilPlayer.message(player, F.main("Server", "Your admin privileges were removed."));
|
||||
UtilPlayer.message(player, F.main("Server", "Your Co-Host privileges were removed."));
|
||||
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
|
||||
@ -713,57 +717,66 @@ public class GameHostManager implements Listener
|
||||
if (!event.getMessage().toLowerCase().startsWith("/e set ") && !event.getMessage().toLowerCase().equals("/e set"))
|
||||
return;
|
||||
|
||||
Player caller = event.getPlayer();
|
||||
String[] args = event.getMessage().split(" ");
|
||||
|
||||
//Parse Game
|
||||
if (args.length >= 3)
|
||||
{
|
||||
ArrayList<GameType> matches = new ArrayList<GameType>();
|
||||
for (GameType type : GameType.values())
|
||||
{
|
||||
if (type.toString().toLowerCase().equals(args[2]))
|
||||
{
|
||||
matches.clear();
|
||||
matches.add(type);
|
||||
break;
|
||||
}
|
||||
|
||||
if (type.toString().toLowerCase().contains(args[2]))
|
||||
{
|
||||
matches.add(type);
|
||||
}
|
||||
}
|
||||
|
||||
if (matches.size() == 0)
|
||||
{
|
||||
event.getPlayer().sendMessage("No results for: " + args[2]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (matches.size() > 1)
|
||||
{
|
||||
event.getPlayer().sendMessage("Matched multiple games;");
|
||||
for (GameType cur : matches)
|
||||
event.getPlayer().sendMessage(cur.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
GameType type = matches.get(0);
|
||||
Manager.GetGame().setGame(type, event.getPlayer(), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Manager.GetGame().setGame(GameType.Event, event.getPlayer(), true);
|
||||
}
|
||||
String game = args[2].toLowerCase();
|
||||
|
||||
|
||||
//Map Pref
|
||||
if (args.length >= 4)
|
||||
{
|
||||
Manager.GetGameCreationManager().MapPref = args[3];
|
||||
UtilPlayer.message(event.getPlayer(), C.cAqua + C.Bold + "Map Preference: " + ChatColor.RESET + args[2]);
|
||||
String map = "";
|
||||
String source = "";
|
||||
if(args.length == 5)
|
||||
{
|
||||
Manager.GetGameCreationManager().MapSource = args[3];
|
||||
Manager.GetGameCreationManager().MapPref = args[4];
|
||||
source = args[3];
|
||||
map = args[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
Manager.GetGameCreationManager().MapSource = args[2];
|
||||
Manager.GetGameCreationManager().MapPref = args[3];
|
||||
source = args[2];
|
||||
map = args[3];
|
||||
}
|
||||
UtilPlayer.message(caller, C.cAqua + C.Bold + "Map Preference: " + ChatColor.RESET + source + ":" + map);
|
||||
}
|
||||
|
||||
//Parse Game
|
||||
ArrayList<GameType> matches = new ArrayList<>();
|
||||
for (GameType type : GameType.values())
|
||||
{
|
||||
if (type.toString().toLowerCase().equals(game))
|
||||
{
|
||||
matches.clear();
|
||||
matches.add(type);
|
||||
break;
|
||||
}
|
||||
|
||||
if (type.toString().toLowerCase().contains(game))
|
||||
{
|
||||
matches.add(type);
|
||||
}
|
||||
}
|
||||
|
||||
if (matches.size() == 0)
|
||||
{
|
||||
caller.sendMessage("No results for: " + game);
|
||||
return;
|
||||
}
|
||||
|
||||
if (matches.size() > 1)
|
||||
{
|
||||
caller.sendMessage("Matched multiple games;");
|
||||
for (GameType cur : matches)
|
||||
caller.sendMessage(cur.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
GameType type = matches.get(0);
|
||||
Manager.GetGame().setGame(type, event.getPlayer(), true);
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user