Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Cheese 2015-10-31 18:23:06 +11:00
commit 3636fdfba0
2 changed files with 77 additions and 53 deletions

View File

@ -755,9 +755,6 @@ public enum Achievement
; ;
private static String[] _colors = { C.cAqua, C.cGreen, C.cDGray, C.cPurple, C.cYellow, C.cGray };
private static int _negativeCount = 0;
private String _name; private String _name;
private String[] _desc; private String[] _desc;
private String[] _stats; private String[] _stats;
@ -823,10 +820,7 @@ public enum Achievement
public static String getExperienceString(int level) public static String getExperienceString(int level)
{ {
if (level < 0) if (level < 0)
{ return C.cPurple + level;
_negativeCount++;
return _colors[_negativeCount % _colors.length] + level;
}
if (level < 20) if (level < 20)
return C.cGray + level; return C.cGray + level;

View File

@ -12,23 +12,29 @@ import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.task.TaskManager; import mineplex.core.task.TaskManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.HubManager; import mineplex.hub.HubManager;
import mineplex.hub.HubType; import mineplex.hub.HubType;
import mineplex.hub.modules.trickortreat.Trick; import mineplex.hub.modules.trickortreat.Trick;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Instrument; import org.bukkit.Instrument;
import org.bukkit.Material;
import org.bukkit.Note; import org.bukkit.Note;
import org.bukkit.Note.Tone; import org.bukkit.Note.Tone;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
public class TrickOrTreatManager extends MiniPlugin public class TrickOrTreatManager extends MiniPlugin
@ -50,36 +56,34 @@ public class TrickOrTreatManager extends MiniPlugin
private HashSet<String> _interacting = new HashSet<String>(); private HashSet<String> _interacting = new HashSet<String>();
// private String[] _nextYear = new String[] private String[] _nextYear = new String[]
// { {
// "Nosy kids...", "Nosy kids...",
// "I'm out of candy!", "I'm out of candy!",
// "Come back next year.", "Come back next year.",
// "No double dipping!", "No double dipping!",
// "I've seen that costume before...", "I've seen that costume before...",
// "You already have enough candy!", "You already have enough candy!",
// "Once is enough.", "Once is enough.",
// "Isn't it past your bedtime?", "Isn't it past your bedtime?",
// "I already gave you my candy, what more do you want!", "I already gave you my candy, what more do you want!",
// "You again...", "You again...",
// "I said no more!", "I said no more!",
// "No taking the whole bowl.", "No taking the whole bowl.",
// "I have my eye on you...", "I have my eye on you...",
// "You know what happens to children who want more candy...", "You know what happens to children who want more candy...",
// "This was a great year, wasn't it?", "This was a great year, wasn't it?",
// "Aww, did you come back just to talk to me?", "Aww, did you come back just to talk to me?",
// "*heavy staring*", "*heavy staring*",
// "Run along, now!", "Run along, now!",
// "The real horror will be your dentist's face...", "The real horror will be your dentist's face...",
// "I've heard good things about the house down the road.", "I've heard good things about the house down the road.",
// "I started out with 700 pieces!", "I started out with 700 pieces!",
// "I might call it a night soon.", "I might call it a night soon.",
// "Meow", "Meow",
// "*heavy ninjaing*", "Sure is a mystical night, isn't it?",
// "*heavy pandaing*", "Do you want to hear my song? I wrote it myself!",
// "Sure is a mystical night, isn't it?", };
// "Do you want to hear my song? I wrote it myself!",
// };
public TrickOrTreatManager(JavaPlugin plugin, HubManager manager, TaskManager taskManager, DonationManager donationManager, CoreClientManager coreClientManager) public TrickOrTreatManager(JavaPlugin plugin, HubManager manager, TaskManager taskManager, DonationManager donationManager, CoreClientManager coreClientManager)
{ {
@ -147,7 +151,7 @@ public class TrickOrTreatManager extends MiniPlugin
{ {
if (!_taskManager.hasCompletedTask(event.getPlayer(), task)) if (!_taskManager.hasCompletedTask(event.getPlayer(), task))
{ {
final boolean trick = UtilMath.r(10) > 4; final boolean trick = UtilMath.r(10) > 5;
UtilPlayer.message(event.getPlayer(), C.cDGreenB + "You: " + C.cGreenB + "Trick or Treat!"); UtilPlayer.message(event.getPlayer(), C.cDGreenB + "You: " + C.cGreenB + "Trick or Treat!");
@ -241,24 +245,50 @@ public class TrickOrTreatManager extends MiniPlugin
} }
else else
{ {
try { Thread.sleep(500); } catch (Exception ex) { } //XXX UtilPlayer.message(event.getPlayer(), C.cGoldB + villagerName + ": " + C.cYellowB + UtilMath.randomElement(_nextYear));
UtilPlayer.message(event.getPlayer(), C.cGoldB + villagerName + ": " + C.cYellowB + "Back for seconds, are we? Looks like someone needs another trick...");
try { Thread.sleep(750); } catch (Exception ex) { } //XXX
runSync(new Runnable()
{
@Override
public void run()
{
new Trick(event.getPlayer(), villagerName);
}
});
} }
_interacting.remove(event.getPlayer().getName()); _interacting.remove(event.getPlayer().getName());
} }
}); });
} }
@EventHandler
public void pumpkinHat(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
for (Player player : UtilServer.getPlayers())
{
if (player.getInventory().getHelmet() == null || player.getInventory().getHelmet().getType() == Material.AIR)
{
double rand = Math.random();
Material mat;
byte data = 0;
if (rand <= 0.25)
{
mat = Material.JACK_O_LANTERN;
}
else if (rand <= 0.5)
{
mat = Material.SKULL_ITEM;
data = 0; // Skeleton
}
else if (rand <= 0.75)
{
mat = Material.SKULL_ITEM;
data = 2; // Zombie
}
else
{
mat = Material.SKULL_ITEM;
data = 4; // Creeper
}
player.getInventory().setHelmet(new ItemStack(mat, 1, (short) 0, data));
}
}
}
} }