Merge branch 'clans/beta' of github.com:Mineplex-LLC/Minecraft-PC into clans/beta

This commit is contained in:
Jonathan Williams 2016-04-04 00:59:25 -05:00
commit 85fabd525a
65 changed files with 615 additions and 512 deletions

View File

@ -19,7 +19,6 @@ import net.minecraft.server.v1_8_R3.NBTTagString;
public class SkinData
{
private static long _nameCount = -99999999999999L;
public final static SkinData MOOSHROOM = new SkinData("eyJ0aW1lc3RhbXAiOjE0NDk4NzI0OTU0MTcsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzIxOWJlYTU0Y2FkN2Q1OGFiNWRhNDA2YjBhOTJhYjNhODI0MjI1MjY2Nzc3ZTUzNGI3ZGI2YzM3MmRkZmY3ZiJ9fX0=","UoSif81+UyvkcaanU8KAMYBpw9mefAmWehE2liDUFvk+y0X/9NovsxTYVpIDCltTSpLW3sNgamvbj4Ybs+s6DbudPiEkvh0ER7Bv2v29UJw7RzIdr6/1g548X12zcnh5iPGz/P75uNRnSfTFQx0ed8P/GNkPIjWpDuJFxEj6KcPzrCAGMx+BVw1VwryBIYf9cCDHky8z0bxR89rjiIvPTBFI6MRhqI3vgpEBTySHDS+Ki0Hwl5oa3PwS6+jgYx/4RSfFsb+BawcvDk2Xpkt5UimvqZ5BceYLIfCt4KbShYipgLXLfYUZrntjPemd3SxthjxUuA07i44UxRdiC8uqy1twLT/HUS28gpk68lA/id9tKFwu1CUzshgcmvQPt3ghtNViNziR/2t7D/+5D31Vzmhf6n7Pnpdirt/5frMi2BKMMs7pLa0EF8CrrDU7QCwPav+EZVGFvVZbxSkCDq+n3IQ3PUWSCzy6KPxpdOlUjD0pAfLoiNj0P8u4+puQtID76r/St8ExchYl2dodUImu1ZETWeFUClF3ZGat62evx8uRQEI2W4dsVwj40VUfjaAuvyDzuouaKTrCzJXLQZZjR1B8URvuK61fGX0nhW607mEi6DE+nxP2ZoBrROEX4e37Ap6+TQn9Q8tKDPdcxtwSOpPO4Qkncjn/mGtP9lZU/DQ=");
@ -33,6 +32,9 @@ public class SkinData
public final static SkinData LOVESTRUCK = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMTAyNDMyNjUsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzczMTY5YWQwZTUyYjM1N2NiZGYxZDU0NGVkNGNmOWJmOTI4YmI0ZWNlMDhlY2YyY2M0YmYyYTlmMjJhODI4MmQifX19", "LL4RiSKQoTZamRQ4QG6izpvhgFu5gAqW4eZxcWAihk7GkhyxifpJpBTOzKrj5hH9fCUfYkkijVWUYTEcVSVRWhocp2HXW59TbKfxOeMvHU5vTMwgpwm6PnUfwuTsRPSLC7WMnEreI3cjOxPVmXbTniOSd+o8j4oOIgwFS+VLPiYLh5Jl16i5I/9ekafl3/x41NISKWl62geqO2jPWehlk+r3soiRJsxaKw20T61GSNLu19iA96Rz2T2tUHB4opm8hbLgoiNL2g1affTjq3cZPLHH4JWF3vPhqLB5uw6xb55vFLM/PP0YiEMIi7YZOfRGeaPp7uXbXgHeew+7PG9UDVMfqbwANQY4ndECijZoei54+xX3MDXkMhQsc5S+FLnGH6e4d008v81eEOyzJUPkKbGxLCBgTUb1s4IHwomCr30twPlo1IuFBOY1qeVvZUfAfPJsREuj5q/oCAoYFgupmb3ClWECnwwaH/T4wdHjfSBHoZQdLzcgDOAl0b5EXxWmYBECqk/WA4TrYIDVGdwkqjI0RkPLUoxTj6135KO+F7P7PwhU9WBGeW8hHq918DBL0fjQVHjrzvolTqwmw6nySSePnPOxFX/iwtHWzpBa9V6kUNNN+V7OGTgRr0H/yUxB+oq1F8UBqyqT4YpqxXCSD36derF/Xt5IdpTbEbGBpm0=");
public final static SkinData SECRET_PACKAGE = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMTAzNzE3OTIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2QyNWI5YTRjOWRhOThkZTliZmIwZDNjOWI1M2MzMjJhMjgxN2IyMTMxOTQzY2E1YWM2NTBjZThmMzEzZjdhIn19fQ==", "Wb5T0Zhp1RVt78V/i8dYrwZCNT0xZIRe3LvL0bngH498f8Jrl43KHgTi4f299zE9giVynkTogGhJ8inq/xqFCRctl7Nn9L3LVu78uQwt+fs+o+kw/Qc+lggFSjEIc+fc13AZndpec0Df46Kh/OGD7NXbtbLb6TE/0dU2RwQlvZrZ/QHYJb8OJ6aUcnHvAZim8NUtG/nlZtSClepHVSuKdNnfzoF9rFVFA/x4jTr6mZYPZ33YgQd2oTAPk+qE3iN+0InjZQNs2YLoKFmFrgzn+tGvNApC0siF0HEZGQCFIwJOtnBsasGoxujIrln/ZdOil+5ac4VWInXr8lKgY0Q3Ocy8/0cJl+E/XqB+ztG29zhB8B1zdHBfJr+MgeSIqBCPx4SCtY6r7gnMlQYG+uVx5NP3S5aJW/cEfDyXmpCykIcBPzeErnKC0SiAqXkCVNjWJpX6qRWvWMXqS69w6ht6qHvEY2GxlZUb5AP+JgFlsl3hJDms6EPvM4zNL0Ko4oWIBzwYRQXiemrP9TGgyo0aL1RcQ0JgBFO2hSo37PK0YL3tUPgteJXzm21wu0TiZLkLCWSgMUfYfvVnhTa+xzod0xvfujpN6Y1DUTdcf8WS8TRYw2JigSkWrRW0fXPBCtTtQN5jiwM5/HrTpNLzg03J6SpfZ+rr8Rhq0S/8beQOMas=");
public final static SkinData CHISS = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTk1NDI5NjgyNDEsInByb2ZpbGVJZCI6IjFkMmJmZTYxN2ViZDQ0NWRiYTdkODM1NGEwZmZkMWVhIiwicHJvZmlsZU5hbWUiOiJDaGlzcyIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTg3MmNkMzRjY2IzMTIxYjRjNmEzOGFjM2JmOGVkM2UwMzk3YmQ2YTg4NDI4YjdhZmM2ZTUyNTI4NTVhMzQzIiwibWV0YWRhdGEiOnsibW9kZWwiOiJzbGltIn19fX0=", "hNTLRA2acZYx2dM90lnJN8FMK/ceD3+AxKNdD5FrXzxGtYL4C1Jr/vbTE0UosmwFP3wScNEW/fuDOjeZRjZHMJdvgDZMlMK/5KDhOY6sj/RS9RckztsgummSyjH/hdDn7TWWfhZLMbiia/K0VReI9eq2yD6zGQpvMlz5hB/5SX5YHWXvCah3TL4UzYSlSVDlwY/Q3sVuIZUr8m/LIXJwniJKLGo6tUgtiJd9eseOsbBpVjzCUtLD8A9WBe2/eODgmLfqEvXESIoDRG8vL2nPSXWma/YolYHIl32/i+ZxVD7dRRaXQFYSiLI24EtzX1pPhMjyaTLazP9abH43J6J31w02pKM7N/xTa62020L/YfRRKGT5lygEDb1NMoSpAjszPxah+Ra2/L+yUWEI8cMES6I4mIJ00tclPjWK01xhIn3tqg+y2gqsGHwPhu/7vmF5NirNfKFw0qciKNBfbCAF7ae+mkUKjmAPuvBUBqQb7BOcpNVWsCo/XvzmiZZYsf5P4Uwz8LqUK4uH6V/5dg7lY2Xg3+IUylsrDqLGFDI8iy/NdjIQMbuRadh4IDO6DcmxBri2Ax4JNBPBTnRezge8uq37MZcft/IXQgFWKB9RtidVEACaTOkRj27k+Ojnkki+j44k0wZB47hiXFUHMCHl3a0SVdQe15ZbVsQj/HAvAS0=");
public final static SkinData DEFEK7 = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTk1NDI3ODkwNTksInByb2ZpbGVJZCI6Ijg5ZDQ2M2Y3MjNlYzQ3MGE4MjQ0NDU3ZjBjOGQ4NjFjIiwicHJvZmlsZU5hbWUiOiJkZWZlazciLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2JmYWNjOWM4ZjhlY2E1OWU0NTE4MTUxZmE4OGFiMDZjOTFmNjM3OTE2NzJmMTRlNGYzODY3YTI2OTVlN2NmYmYifSwiQ0FQRSI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzIyYjljNWVhNzYzYzg2ZmM1Y2FlYTMzZDgyYjBmYTY1YTdjMjI4ZmQzMjFiYTU0NzY2ZWE5NWEzZDBiOTc5MyJ9fX0=", "jBoRvkhQXz+nap8yJJIZ+4HClMItWODumeSOYjXytP3WWKHK0UMq0xC/keXsnmvo89lMRdRbknPt2ZX5Flgyjgr4Rt0KtDvpL/hG4BUsTWryUZZMKxdd6DkZXYRtTogLUfHeDYIz+cZQ0aXGMtvX/ZYTXJfMi6FYbIHY/qEEDnWhDX5y+SPpaJaZByPsvzi+qbfcFGnJ6nqi9ccyZYnYpnI2IVBM/yO/VRXWHxfqvJ0VVvv5KsGmVbko2Jxo0SDCxUL2UTH2+eol53FxhkkC+m2geC14k1zsZQLHDF3BgAG9+kFJ4UEoYRKF2Gy1FxeDCJtjYNdrYR8fdaUKRMcpBgEs+ZGe2U9EVVS/ZcBCjB7S+1Ne2bPzPFzTQPuBoMgggo1xbxBmQ5NyhYo4gwgj/xjSLIhb+5h7ioN1URfSRcfYdVv6RRO9l/u9l09jEom8y/jGRviefpEr+/e9iAl5Dd/6nzQgosBQja3NSfqYZmyuet2eI9zu61CObDTpR6yaCbNgBe/lWofRfULdpJpgjb4UNTBom3q82FcCiOe02OekGPw4+YlilhICBhajF5JzN8FKAdqI1osDcX3KuJgikYIW3voNaOP5YN3GXgilJNdou20KFC8ICq68HglgX7/0rLrWKIEoswnINIM6HcJbQuXncVPwQhV6K34Hlt/Na60=");
private Property _skinProperty;
public SkinData(String value, String signature)

View File

@ -88,7 +88,7 @@ public class ProfileLoader
}
catch (Exception e)
{
; // Failed to load skin
e.printStackTrace();
}
}

View File

@ -5,6 +5,28 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Giant;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.EntityEquipment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;
import net.minecraft.server.v1_8_R3.AxisAlignedBB;
import net.minecraft.server.v1_8_R3.EntityBat;
import net.minecraft.server.v1_8_R3.EntityCreature;
@ -23,27 +45,6 @@ import net.minecraft.server.v1_8_R3.PathfinderGoalRandomLookaround;
import net.minecraft.server.v1_8_R3.PathfinderGoalSelector;
import net.minecraft.server.v1_8_R3.WorldServer;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Giant;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;
public class UtilEnt
{
@ -257,6 +258,34 @@ public class UtilEnt
}
}
public static void Rotate(LivingEntity entity, float yaw, float pitch)
{
EntityLiving handle = ((CraftLivingEntity) entity).getHandle();
while (yaw < -180.0F) yaw += 360.0F;
while (yaw >= 180.0F) yaw -= 360.0F;
handle.yaw = yaw;
handle.aK = yaw;
handle.aI = yaw;
handle.aL = yaw;
handle.pitch = pitch;
}
public static void LookAt(LivingEntity entity, Location location)
{
if (!(entity.getWorld().equals(location.getWorld())))
return;
Vector dir = entity.getEyeLocation().toVector().subtract(location.toVector()).normalize();
Location loc = entity.getEyeLocation().clone();
loc.setYaw(180 - (float) Math.toDegrees(Math.atan2(dir.getX(), dir.getZ())));
loc.setPitch(90 - (float) Math.toDegrees(Math.acos(dir.getY())));
Rotate(entity, loc.getYaw(), loc.getPitch());
}
public static void populate()
{
if (creatureMap.isEmpty())
@ -844,4 +873,10 @@ public class UtilEnt
return entity.getMetadata(key).get(0);
}
public static void SetItemInHand(LivingEntity entity, ItemStack item)
{
EntityEquipment equipment = entity.getEquipment();
equipment.setItemInHand(item);
}
}

View File

@ -486,6 +486,7 @@ public class NpcManager extends MiniPlugin
public void removeFakeNpc(Npc npc)
{
_npcs.remove(npc);
npc.getEntity().remove();
}
public void loadNpcs() throws SQLException

View File

@ -7,6 +7,7 @@ import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.CustomTagFix;
import mineplex.core.FoodDupeFix;
import mineplex.core.PacketsInteractionFix;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.antihack.AntiHack;
@ -42,7 +43,6 @@ import mineplex.core.teleport.Teleport;
import mineplex.core.updater.FileUpdater;
import mineplex.core.updater.Updater;
import mineplex.core.visibility.VisibilityManager;
import mineplex.game.clans.analytics.Profiler;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.ban.ClansBanManager;
import mineplex.game.clans.items.GearManager;
@ -67,9 +67,6 @@ public class Clans extends JavaPlugin
@Override
public void onEnable()
{
// Initialize Profiler
new Profiler();
// Configs
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
@ -133,7 +130,7 @@ public class Clans extends JavaPlugin
new Explosion(this, blockRestore);
new InventoryManager(this, _clientManager);
ResourcePackManager resourcePackManager = new ResourcePackManager(this, portal);
resourcePackManager.setResourcePack("http://garblox.com/files/b/ResClans.zip", "http://garblox.com/files/b/ResClans19.zip", true);
resourcePackManager.setResourcePack("http://phinary.ca/ResClans.zip", "http://phinary.ca/ResClans19.zip", true);
// Enable custom-gear related managers
new CustomTagFix(this, packetHandler);

View File

@ -1,37 +0,0 @@
package mineplex.game.clans.analytics;
public class Analytic
{
private long _start;
private long _elapsed;
private String _section;
private String[] _data;
public Analytic(String section, String[] data, long start, long elapsed)
{
_data = data;
_elapsed = elapsed;
_start = start;
_section = section;
}
public String[] getData()
{
return _data;
}
public long getStart()
{
return _start;
}
public long getElapsed()
{
return _elapsed;
}
public String getSection()
{
return _section;
}
}

View File

@ -1,94 +0,0 @@
package mineplex.game.clans.analytics;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import mineplex.core.common.util.MapBuilder;
import mineplex.core.common.util.UtilCollections;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWeb;
public class AnalyticQueuer extends Thread
{
private ByteArrayOutputStream stream = new ByteArrayOutputStream();
private DataOutputStream out = new DataOutputStream(stream);
private long _lastPush = System.currentTimeMillis();
public void Queue(Section section, String[] data)
{
// new Thread(() -> {
// write(new Analytic(section.getSection(), data, section.getStart(), section.getElapsed()));
// }).start();
}
private void write(Analytic analytic)
{
try
{
out.writeLong(analytic.getStart());
out.writeLong(analytic.getElapsed());
out.writeInt(analytic.getSection().getBytes().length);
out.writeBytes(analytic.getSection());
String data = analytic.getData() == null ? "" : UtilCollections.combine(analytic.getData(), ",");
System.out.println("data: " + data);
out.writeInt(data.length());
if (analytic.getData() != null)
{
out.writeBytes(data);
}
}
catch (Exception exception)
{
exception.printStackTrace();
}
}
public void run()
{
// while (true)
// {
// if (UtilTime.elapsed(_lastPush, 10000))
// {
// System.out.println("PUSHING: Bytes[" + out.size() + "]");
//
// String response = UtilWeb.doPOST("http://analytics.garblox.com/PushAnalyticData",
// new MapBuilder<String, Object>()
// .Put("authkey", Profiler.ANALYTICS_KEY)
// .Put("service", "ClansBeta")
// .Put("data", stream.toString())
// .GetMap()
// );
//
// // Clear
// stream.reset();
//
// if (!response.equals("OK"))
// {
// System.out.println("[Clans Beta] Error while pushing analytic data to garblox: " + response);
// }
// else
// {
// System.out.println("ANALYTICS: OK.");
// }
//
// _lastPush = System.currentTimeMillis();
// }
//
// try
// {
// Thread.sleep(250);
// }
// catch (Exception exception)
// {
// exception.printStackTrace();
// }
// }
}
}

View File

@ -1,84 +0,0 @@
package mineplex.game.clans.analytics;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.Stack;
import mineplex.core.common.util.MapBuilder;
import mineplex.core.common.util.UtilFile;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilWeb;
import mineplex.game.clans.clans.ClansManager;
public class Profiler
{
// public static final String ANALYTICS_KEY;
public static Profiler Instance;
private Map<Thread, Stack<Section>> _sections = new HashMap<>();
private AnalyticQueuer _queuer;
static
{
// ANALYTICS_KEY = UtilFile.read(new File(UtilServer.getServer().getWorldContainer() + "/GarbloxAnalyticsKey"));
}
public Profiler()
{
_queuer = new AnalyticQueuer();
// _queuer.start();
// String response = UtilWeb.doPOST("http://analytics.garblox.com/RegisterAnalytics",
// new MapBuilder<String, Object>()
// .Put("authkey", Profiler.ANALYTICS_KEY)
// .Put("name", "ClansBeta")
// .GetMap()
// );
//
// if (!response.equals("OK"))
// {
// System.out.println("[Clans Beta Analytics] Error while registering new analytic type: " + response);
// }
Instance = this;
}
public void start(String section)
{
// Thread thread = Thread.currentThread();
//
// if (_sections.get(thread) == null)
// {
// _sections.put(thread, new Stack<>());
// }
//
// _sections.get(thread).push(new Section(section, System.currentTimeMillis(), thread));
}
public void end(String... data)
{
// Thread thread = Thread.currentThread();
//
// Section section = _sections.get(thread).pop();
//
// if (data == null || data.length == 0)
// {
// data = new String[] { "Server:" + UtilServer.getServerName() };
// }
// else
// {
// String[] newData = new String[data.length + 1];
//
// System.arraycopy(data, 0, newData, 1, data.length);
//
// data = newData;
//
// data[0] = "Server:" + UtilServer.getServerName();
// }
//
// _queuer.Queue(section, data);
}
}

View File

@ -1,36 +0,0 @@
package mineplex.game.clans.analytics;
public class Section
{
private String _section;
private long _start;
private Thread _thread;
public Section(String section, long start, Thread thread)
{
_section = section;
_start = start;
_thread = thread;
}
public String getSection()
{
return _section;
}
public long getStart()
{
return _start;
}
public long getElapsed()
{
return System.currentTimeMillis() - _start;
}
public Thread getThread()
{
return _thread;
}
}

View File

@ -821,7 +821,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
List<Player> recipients = new ArrayList<>();
for (Player other : UtilServer.getPlayers())
for (Player other : event.getRecipients())
{
ClanInfo otherClan = _clanUtility.getClanByPlayer(other);

View File

@ -21,6 +21,8 @@ public class ClansBlacklist extends MiniPlugin
super("Clan Name Blacklist", plugin);
_repository = new ClanNameBlacklistRepository(plugin, this);
runAsync(() -> _repository.loadNames(this::setBlacklist));
}
// Fetch new blacklisted clans every 16 seconds (in case someone blacklists a clan name on a different server)

View File

@ -22,7 +22,6 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.analytics.Profiler;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.siege.commands.CommandSiegeSupplies;
import mineplex.game.clans.clans.siege.outpost.OutpostManager;
@ -146,7 +145,6 @@ public class SiegeManager extends MiniPlugin
_outpostManager.saveOutposts();
saveSiegeWeapons();
Profiler.Instance.start("SiegeManager.CleanupEntities");
for (Entity entity : Spawn.getSpawnWorld().getEntitiesByClass(ArmorStand.class))
{
boolean part = false;
@ -185,7 +183,6 @@ public class SiegeManager extends MiniPlugin
}
}
}
Profiler.Instance.end();
}
}
@ -207,8 +204,6 @@ public class SiegeManager extends MiniPlugin
runAsync(() -> {
Profiler.Instance.start("SiegeManager.CleanupEntities");
while (!queue.isEmpty())
{
queue.pop().run();
@ -223,8 +218,6 @@ public class SiegeManager extends MiniPlugin
}
});
});
Profiler.Instance.end();
});
}

View File

@ -24,11 +24,9 @@ import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.analytics.Profiler;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent;
import mineplex.game.clans.clans.nameblacklist.ClansBlacklist;
import mineplex.game.clans.clans.siege.SiegeManager;
import mineplex.game.clans.clans.siege.repository.OutpostRepository;
import mineplex.game.clans.clans.siege.repository.tokens.OutpostToken;
@ -294,8 +292,6 @@ public class OutpostManager extends MiniPlugin
});
runAsync(() -> {
Profiler.Instance.start("OutpostManager.UpdateOutposts");
while (!queue.isEmpty())
queue.pop().run();
@ -308,8 +304,6 @@ public class OutpostManager extends MiniPlugin
}
});
});
Profiler.Instance.end();
});
}

View File

@ -12,7 +12,6 @@ import com.google.common.collect.Lists;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.database.MinecraftRepository;
import mineplex.game.clans.analytics.Profiler;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.siege.outpost.OutpostManager;
import mineplex.game.clans.clans.siege.outpost.OutpostState;

View File

@ -119,7 +119,8 @@ public class Cannon extends SiegeWeapon
return false;
}
if(_clans.hasTimer(player)) {
if(_clans.hasTimer(player))
{
UtilPlayer.message(player, F.main("Clans", "You cannot ride on a Cannon whilst on PvPTimer"));
return false;
}
@ -130,7 +131,7 @@ public class Cannon extends SiegeWeapon
public Cannon(Location location, ClanInfo clan, SiegeManager siegeManager, boolean syncWithDb)
{
super(2, location, 1400, "Cannon", clan, clan.Clans, siegeManager);
super(2, location.clone().add(0.5, 0, 0.5), 1400, "Cannon", clan, clan.Clans, siegeManager);
_syncWithDb = syncWithDb;
@ -222,6 +223,11 @@ public class Cannon extends SiegeWeapon
if (event.getClick() == ClickType.SHIFT_RIGHT)
{
if(_inventory.getViewers().contains(event.getWhoClicked()))
{
event.setCancelled(true); //block shift right clicking tnt into this inventory
getClans().runSyncLater(() -> ((Player) event.getWhoClicked()).updateInventory(), 1L);
}
return;
}
@ -293,7 +299,7 @@ public class Cannon extends SiegeWeapon
private void loadEntities()
{
Slime filler = _location.getWorld().spawn(_location.clone().add(.5, 0, .5), Slime.class);
Slime filler = _location.getWorld().spawn(_location.clone(), Slime.class);
UtilEnt.silence(filler, true);
UtilEnt.Vegetate(filler);
@ -303,7 +309,7 @@ public class Cannon extends SiegeWeapon
addEntity(filler, "Filler_1");
Slime playerMount = _location.getWorld().spawn(_location.clone().add(.5, 0, .5), Slime.class);
Slime playerMount = _location.getWorld().spawn(_location.clone(), Slime.class);
UtilEnt.silence(playerMount, true);
UtilEnt.Vegetate(playerMount);
@ -314,7 +320,7 @@ public class Cannon extends SiegeWeapon
getEntity("Filler_1").setPassenger(playerMount);
addEntity(playerMount, "PLAYERMOUNT");
ArmorStand weapon = _location.getWorld().spawn(_location.clone().add(.5, 0, .5), ArmorStand.class);
ArmorStand weapon = _location.getWorld().spawn(_location.clone(), ArmorStand.class);
UtilEnt.setFakeHead(weapon, true);
weapon.teleport(_location);
@ -325,6 +331,7 @@ public class Cannon extends SiegeWeapon
addEntity(weapon, "WEAPON");
insert();
}

View File

@ -14,6 +14,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
@ -23,6 +24,7 @@ import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
@ -160,15 +162,15 @@ public abstract class SiegeWeapon implements Listener
_infoHologram = new Hologram(ClansManager.getInstance().getHologramManager(), _location.clone().add(.5, 3, .5), _name + " Health", getDisplayHealth());
_infoHologram.start();
_infoHologram.setInteraction((player, type) -> {
if (player.equals(_rider))
{
if (type.equals(ClickType.LEFT))
{
handleLeftClick(player);
}
}
});
// _infoHologram.setInteraction((player, type) -> {
// if (player.equals(_rider))
// {
// if (type.equals(ClickType.LEFT))
// {
// handleLeftClick(player);
// }
// }
// });
UtilServer.RegisterEvents(this);
@ -501,7 +503,7 @@ public abstract class SiegeWeapon implements Listener
return;
}
if (Recharge.Instance.use(player, "Damage Cannon", 200, false, false))
if (!player.equals(_rider) && Recharge.Instance.use(player, "Damage Cannon", 200, false, false))
{
int health = calculateDamage(player);
@ -712,7 +714,14 @@ public abstract class SiegeWeapon implements Listener
public void onDmg(EntityDamageByEntityEvent event)
{
if (_comprisedOf.contains(event.getEntity()) && event.getDamager() instanceof Player)
handleLeftClick((Player) event.getDamager());
{
if (!((Player) event.getDamager()).equals(_rider))
{
handleLeftClick((Player) event.getDamager());
}
event.setCancelled(true);
}
}
@EventHandler
@ -744,6 +753,29 @@ public abstract class SiegeWeapon implements Listener
}
}
@EventHandler
public void onInteract(PlayerInteractEvent event)
{
if (!event.getPlayer().equals(_rider))
{
System.out.println("NOT RIDER");
return;
}
System.out.println(event.getAction());
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)
{
handleRightClick(event.getPlayer());
event.setCancelled(true);
}
else if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)
{
handleLeftClick(event.getPlayer());
event.setCancelled(true);
}
}
@EventHandler
public void onInteract(PlayerInteractEntityEvent event)
{
@ -824,7 +856,7 @@ public abstract class SiegeWeapon implements Listener
public Location getLocation()
{
return _location;
return _location.clone();
}
public double getSize()

View File

@ -6,14 +6,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import mineplex.core.common.util.*;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.scoreboard.ScoreboardManager;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansManager;
@ -184,4 +181,15 @@ public class KingHill extends WorldEvent
{
public int TicksOnHill;
}
@Override
public void announceStart()
{
for(Player player : UtilServer.getPlayers()) {
if(_clansManager.getTutorials().isInTutorial(player)) continue;
UtilTextMiddle.display(C.cGreen + getName(), UtilWorld.locToStrClean(getCenterLocation()), 10, 100, 40, player);
player.sendMessage(F.main("Event", F.elem(getName()) + " has started at coordinates " + F.elem(UtilWorld.locToStrClean(getCenterLocation()))));
}
}
}

View File

@ -4,22 +4,18 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import mineplex.core.common.util.*;
import mineplex.game.clans.clans.ClansManager;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
@ -509,4 +505,16 @@ public class UndeadCamp extends WorldEvent
}
}
}
@Override
public void announceStart()
{
for(Player player : UtilServer.getPlayers()) {
if(ClansManager.getInstance().getTutorials().isInTutorial(player)) continue;
UtilTextMiddle.display(C.cGreen + getName(), UtilWorld.locToStrClean(getCenterLocation()), 10, 100, 40, player);
player.sendMessage(F.main("Event", F.elem(getName()) + " has started at coordinates " + F.elem(UtilWorld.locToStrClean(getCenterLocation()))));
}
}
}

View File

@ -431,7 +431,7 @@ public class Gameplay extends MiniPlugin
{
return;
}
Block block = event.getClickedBlock();
// Knock

View File

@ -29,7 +29,7 @@ public class PvpItem extends ShopItem
super(type, data, name, new String[] {
C.cWhite + " ",
LEFT_CLICK_BUY,
C.cWhite + "Costs " + C.cGreen + (buyPrice == 0 ? "Free" : buyPrice + "g"),
C.cWhite + "Costs " + C.cGreen + (buyPrice == 0 ? "Free (Tutorial)" : buyPrice + "g"),
C.cWhite + " ",
UtilItem.isArmor(type) || UtilItem.isTool(type) ? "" : C.cYellow + "Shift Left-Click" + C.cWhite + " to Buy " + C.cGreen + bulkCount,
UtilItem.isArmor(type) || UtilItem.isTool(type) ? "" : C.cWhite + "Costs " + C.cGreen + (buyPrice * bulkCount) + "g", C.cWhite + " ",

View File

@ -15,6 +15,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
@ -159,7 +160,7 @@ public abstract class Tutorial implements Listener, ObjectiveListener
{
}
private void finish(Player player)
protected final void finish(Player player)
{
_objectives.forEach(objective -> objective.clean(player, getRegion(player)));
@ -193,6 +194,9 @@ public abstract class Tutorial implements Listener, ObjectiveListener
_worldManager.returnRegion(session.getRegion());
}
if (session.getSpawnHologram() != null)
session.getSpawnHologram().stop();
session.getHolograms().forEach(Hologram::stop);
}
}
@ -233,7 +237,8 @@ public abstract class Tutorial implements Listener, ObjectiveListener
int objectiveIndex = session.getObjectiveIndex();
Objective currentObjective = _objectives.get(objectiveIndex);
lines.add(C.cGoldB + (objectiveIndex + 1) + "/" + _objectives.size() + ": " + currentObjective.getName(player));
lines.add(C.cGreenB + currentObjective.getName(player));
lines.add(" ");
currentObjective.addScoreboardLines(player, lines);
}
return lines;
@ -273,6 +278,15 @@ public abstract class Tutorial implements Listener, ObjectiveListener
}
}
@EventHandler
public void onHungerChange(FoodLevelChangeEvent event)
{
if (event.getEntity() instanceof Player && isInTutorial(((Player) event.getEntity())))
{
event.setFoodLevel(20);
}
}
@EventHandler
public void displayDescription(UpdateEvent event)
{
@ -281,7 +295,7 @@ public abstract class Tutorial implements Listener, ObjectiveListener
for (Map.Entry<Player, TutorialSession> entry : _playerSessionMap.entrySet())
{
String prefix = entry.getValue().incrementAndGetColorTick() % 2 == 0 ? C.cYellow : C.cGold;
String prefix = entry.getValue().incrementAndGetColorTick() % 2 == 0 ? C.cWhite : C.cGreen;
Objective objective = _objectives.get(entry.getValue().getObjectiveIndex());
UtilTextBottom.display(prefix + objective.getDescription(entry.getKey()), entry.getKey());
}
@ -297,12 +311,8 @@ public abstract class Tutorial implements Listener, ObjectiveListener
for (Map.Entry<Player, TutorialSession> entry : _playerSessionMap.entrySet())
{
String extra = _objectives.get(entry.getValue().getObjectiveIndex()).getExtraDescription(entry.getKey());
if (extra == null)
{
// None defined.
continue;
}
Player player = entry.getKey();
Objective objective = _objectives.get(entry.getValue().getObjectiveIndex());
if (entry.getValue().incrementAndGetTextSeconds() < 20)
{
@ -310,10 +320,7 @@ public abstract class Tutorial implements Listener, ObjectiveListener
return;
}
UtilPlayer.message(entry.getKey(), C.cGold + C.Strike + "---------------------------------------------");
UtilPlayer.message(entry.getKey(), C.cGray + " " + extra);
UtilPlayer.message(entry.getKey(), C.cGold + C.Strike + "---------------------------------------------");
entry.getValue().setTextSeconds(0);
objective.displayChatMessages(player);
}
}
@ -327,6 +334,39 @@ public abstract class Tutorial implements Listener, ObjectiveListener
}
}
public void setSpawnHologram(Player player, Location location, String... text)
{
if (_playerSessionMap.containsKey(player))
{
TutorialSession session = _playerSessionMap.get(player);
if (session.getSpawnHologram() == null && !session.isRemovedHologram())
{
Hologram hologram = new Hologram(_hologram, location, text);
session.setSpawnHologram(hologram);
hologram.start();
}
else
{
session.getSpawnHologram().setText(text);
}
}
}
public void removeSpawnHologram(Player player)
{
if (_playerSessionMap.containsKey(player))
{
TutorialSession session = _playerSessionMap.get(player);
if (session.getSpawnHologram() != null)
{
session.getSpawnHologram().stop();
session.setSpawnHologram(null);
}
session.setRemovedHologram(true);
}
}
public TutorialSession getTutorialSession(Player player)
{
return _playerSessionMap.get(player);

View File

@ -121,6 +121,15 @@ public class TutorialManager extends MiniPlugin implements ScoreboardElement
return null;
}
public void finishTutorial(Player player)
{
Tutorial tutorial = getTutorial(player);
if (tutorial != null)
{
tutorial.finish(player);
}
}
public boolean startTutorial(Player player, TutorialType type)
{
if (inTutorial(player))

View File

@ -9,6 +9,7 @@ import mineplex.core.hologram.Hologram;
public class TutorialSession
{
private final long _startTime;
private int _objectiveIndex;
private TutorialRegion _region;
private List<Hologram> _hologramList = new ArrayList<>();
@ -16,9 +17,12 @@ public class TutorialSession
private int _colorTick;
private int _textSeconds;
private Location _mapTargetLocation;
private Hologram _spawnHologram;
private boolean _removedHologram;
public TutorialSession()
{
_startTime = System.currentTimeMillis();
}
public List<Hologram> getHolograms()
@ -81,4 +85,34 @@ public class TutorialSession
{
return _mapTargetLocation;
}
public long getStartTime()
{
return _startTime;
}
public long getElapsedTime()
{
return System.currentTimeMillis() - _startTime;
}
public boolean isRemovedHologram()
{
return _removedHologram;
}
public void setRemovedHologram(boolean removedHologram)
{
_removedHologram = removedHologram;
}
public void setSpawnHologram(Hologram spawnHologram)
{
_spawnHologram = spawnHologram;
}
public Hologram getSpawnHologram()
{
return _spawnHologram;
}
}

View File

@ -36,7 +36,7 @@ public class TutorialWorldManager extends MiniPlugin
WorldCreator creator = new WorldCreator(worldName);
creator.generator(new VoidGenerator());
_tutorialWorld = Bukkit.createWorld(creator);
_tutorialWorld.setDifficulty(Difficulty.PEACEFUL);
_tutorialWorld.setDifficulty(Difficulty.EASY);
_tutorialWorld.setGameRuleValue("doDaylightCycle", "false");
_tutorialWorld.setTime(6000);
_tutorialWorld.setAutoSave(false);

View File

@ -0,0 +1,23 @@
package mineplex.game.clans.tutorial.command;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.game.clans.tutorial.TutorialManager;
public class FinishCommand extends CommandBase<TutorialManager>
{
public FinishCommand(TutorialManager plugin)
{
super(plugin, Rank.MODERATOR, "finish", "end");
}
@Override
public void Execute(Player caller, String[] args)
{
Plugin.finishTutorial(caller);
}
}

View File

@ -13,7 +13,7 @@ public class StartCommand extends CommandBase<TutorialManager>
{
public StartCommand(TutorialManager plugin)
{
super(plugin, Rank.JNR_DEV, "start");
super(plugin, Rank.MODERATOR, "start");
}
@Override

View File

@ -13,9 +13,10 @@ public class TutorialCommand extends MultiCommandBase<TutorialManager>
{
public TutorialCommand(TutorialManager plugin)
{
super(plugin, Rank.JNR_DEV, "tutorial", "tut");
super(plugin, Rank.MODERATOR, "tutorial", "tut");
AddCommand(new StartCommand(plugin));
AddCommand(new FinishCommand(plugin));
}
@Override

View File

@ -199,8 +199,6 @@ public abstract class Objective<Plugin extends Tutorial, Data extends ObjectiveD
{
System.out.println(String.format("Tutorial> [%s] finished objective [%s]", player.getName(), getName(player)));
showFinishMessage(player);
_active.remove(player.getUniqueId());
if (_displayFinishMessage)
@ -269,12 +267,35 @@ public abstract class Objective<Plugin extends Tutorial, Data extends ObjectiveD
private void showStartMessage(Player player)
{
UtilTextMiddle.display(C.cAqua + "Next Tutorial", getName(player), 20, 60, 20, player);
UtilTextMiddle.display(C.cAqua + "Next Tutorial Section", getName(player), 20, 60, 20, player);
}
private void showFinishMessage(Player player)
{
UtilTextMiddle.display(C.cGreen + "Tutorial Completed", getName(player), 20, 60, 20, player);
UtilTextMiddle.display(C.cGreen + "Tutorial Section Completed", getName(player), 20, 60, 20, player);
}
public void displayChatMessages(Player player)
{
for (int i = 0; i < 1; i++)
{
UtilPlayer.message(player, "");
}
ObjectiveGoal<?> goal = getLatestGoal(player);
String name = goal == null ? getName(player) : goal.getName(player);
String extra = getExtraDescription(player);
// UtilPlayer.message(player, C.cGold + C.Strike + "---------------------------------------------");
UtilPlayer.message(player, C.cPurpleB + name);
if (extra != null)
{
UtilPlayer.message(player, "");
UtilPlayer.message(player, C.cGray + " " + extra);
}
UtilPlayer.message(player, "");
UtilPlayer.message(player, C.cGreen + getDescription(player));
// UtilPlayer.message(player, C.cGold + C.Strike + "---------------------------------------------");
getPlugin().getTutorialSession(player).setTextSeconds(0);
}
public void setDisplayStartMessage(boolean displayStartMessage)
@ -282,6 +303,8 @@ public abstract class Objective<Plugin extends Tutorial, Data extends ObjectiveD
_displayStartMessage = displayStartMessage;
}
public abstract ObjectiveGoal<?> getLatestGoal(Player player);
public void setDisplayFinishMessage(boolean displayFinishMessage)
{
_displayFinishMessage = displayFinishMessage;

View File

@ -122,7 +122,8 @@ public abstract class ObjectiveGoal <T extends Objective<?, ?>> implements Liste
{
System.out.println(String.format("Tutorial> [%s] finished objective goal [%s]", player.getName(), getName(player)));
getObjective().getPlugin().getTutorialSession(player).setTextSeconds(0);
if (getObjective().getPlugin().getTutorialSession(player) != null)
getObjective().getPlugin().getTutorialSession(player).setTextSeconds(0);
_removeList.add(player.getUniqueId());
@ -152,7 +153,7 @@ public abstract class ObjectiveGoal <T extends Objective<?, ?>> implements Liste
*/
protected void clean(Player player, TutorialRegion region)
{
_removeList.add(player.getUniqueId());
}
public T getObjective()
@ -174,18 +175,7 @@ public abstract class ObjectiveGoal <T extends Objective<?, ?>> implements Liste
UtilTextMiddle.display(C.cYellow + "New Objective", getName(player), player);
if (getExtraDescription(player) != null)
{
for (int i = 0; i < 5; i++)
{
UtilPlayer.message(player, "");
}
// Display extra information for the first time.
UtilPlayer.message(player, C.cGold + C.Strike + "---------------------------------------------");
UtilPlayer.message(player, C.cGray + " " + getExtraDescription(player));
UtilPlayer.message(player, C.cGold + C.Strike + "---------------------------------------------");
getObjective().getPlugin().getTutorialSession(player).setTextSeconds(0);
}
_objective.displayChatMessages(player);
}
public void setDisplayStartMessage(boolean displayStartMessage)

View File

@ -73,6 +73,14 @@ public abstract class OrderedObjective<Plugin extends Tutorial> extends Objectiv
return _goals.get(index).getExtraDescription(player);
}
@Override
public ObjectiveGoal<?> getLatestGoal(Player player)
{
OrderedObjectiveData data = getData(player);
int index = data == null ? 0 : data.getIndex();
return _goals.get(index);
}
@Override
protected void customStart(Player player)
{

View File

@ -36,6 +36,12 @@ public abstract class SingleObjective<Plugin extends Tutorial> extends Objective
// Do Nothing
}
@Override
public ObjectiveGoal<?> getLatestGoal(Player player)
{
return null;
}
@Override
protected List<ObjectiveGoal<?>> getGoals()
{

View File

@ -74,6 +74,15 @@ public abstract class UnorderedObjective<Plugin extends Tutorial> extends Object
return index == -1 ? super.getExtraDescription(player) : _goals.get(index).getExtraDescription(player);
}
@Override
public ObjectiveGoal<?> getLatestGoal(Player player)
{
UnorderedObjectiveData data = getData(player);
if (data == null) return null;
int index = data.getFirstIncompleteIndex();
return index == -1 ? null : _goals.get(index);
}
@Override
protected void customStart(Player player)
{

View File

@ -6,10 +6,12 @@ import java.util.List;
import java.util.Objects;
import java.util.UUID;
import mineplex.core.hologram.Hologram;
import mineplex.core.common.util.*;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent;
import mineplex.game.clans.clans.event.ClansPlayerSellItemEvent;
import mineplex.game.clans.clans.event.PreEnergyShopBuyEvent;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.*;
import org.bukkit.block.Block;
@ -22,19 +24,25 @@ import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.hologram.HologramManager;
import mineplex.core.npc.NpcManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent;
import mineplex.game.clans.economy.GoldManager;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import mineplex.game.clans.message.ClansMessageManager;
import mineplex.game.clans.spawn.Spawn;
import mineplex.game.clans.tutorial.Tutorial;
import mineplex.game.clans.tutorial.TutorialRegion;
import mineplex.game.clans.tutorial.TutorialSession;
import mineplex.game.clans.tutorial.TutorialWorldManager;
import mineplex.game.clans.tutorial.map.TutorialMapManager;
import mineplex.game.clans.tutorial.tutorials.clans.objective.AttackEnemyObjective;
@ -89,18 +97,18 @@ public class ClansMainTutorial extends Tutorial
protected void onFinish(Player player)
{
_fireworks.add(player);
UtilTextMiddle.display(C.cYellow + "Congratulations", "You have completed the Tutorial!", 10, 60, 10);
UtilTextMiddle.display(C.cYellow + "Congratulations", "You have completed the Tutorial!", 10, 60, 10, player);
Bukkit.getScheduler().runTaskLater(getPlugin(), () -> {
_fireworks.remove(player);
getMessage().removePlayer(player);
getMessage().removePlayer(player);
player.teleport(Spawn.getNorthSpawn());
player.teleport(Spawn.getNorthSpawn());
UtilInv.Clear(player);
ClansManager.getInstance().getItemMapManager().setMap(player);
}, 20 * 10L);
player.setWalkSpeed(0.2F);
//ClansManager.getInstance().getPvpTimer().unpause(player);
@ -130,7 +138,7 @@ public class ClansMainTutorial extends Tutorial
protected void onStart(Player player)
{
TutorialRegion region = getRegion(player);
player.teleport(getSpawn(region));
spawnFences(region, DyeColor.BLACK); // Fields
spawnFences(region, DyeColor.BROWN); // Shops
@ -138,19 +146,24 @@ public class ClansMainTutorial extends Tutorial
player.setGameMode(GameMode.SURVIVAL);
player.getInventory().clear();
player.getInventory().setArmorContents(new ItemStack[4]);
player.setHealth(20);
player.setFoodLevel(20);
//ClansManager.getInstance().getPvpTimer().pause(player);
// Spawn Holograms
addHologram(player,
getPoint(region, ClansMainTutorial.Point.SPAWN).add(0, 1.5, -6),
setSpawnHologram(player,
getPoint(region, ClansMainTutorial.Point.SPAWN).add(0, 1.5, -3),
C.cGoldB + "Welcome to the Clans Tutorial!",
" ",
"This will teach you the basics of Clans.",
"It will take about 5 minutes to complete.",
"You must complete it before playing Clans.",
" ",
"Walk forward to begin!");
"Starting in " + C.cGreen + "10 Seconds");
player.setWalkSpeed(0);
addHologram(player,
getPoint(region, ClansMainTutorial.Point.SPAWN).add(0, 1.5, -23),
@ -219,7 +232,9 @@ public class ClansMainTutorial extends Tutorial
// Boulders for ores to spawn in?
SHOPS(DyeColor.YELLOW),
// Little shop areas similar to Shops in clans map
ENEMY_ATTACK_AREA(DyeColor.BLACK); // W
ENEMY_ATTACK_AREA(DyeColor.BLACK),
NPC_DIE_AREA(DyeColor.BLUE),
NPC_SHOOT_AREA(DyeColor.BROWN);
// Gray Wool - Cannon Location
// Magenta Wool - Spawn
// Lime Wool - Farming Shop
@ -246,7 +261,9 @@ public class ClansMainTutorial extends Tutorial
PVP_SHOP(DyeColor.PINK),
ENERGY_SHOP(DyeColor.SILVER),
MINING_SHOP(DyeColor.ORANGE),
CANNON(DyeColor.GRAY);
CANNON(DyeColor.GRAY),
NPC_1(DyeColor.CYAN),
NPC_2(DyeColor.WHITE);
private DyeColor _dataLocColor;
@ -419,6 +436,39 @@ public class ClansMainTutorial extends Tutorial
*/
}
@EventHandler
public void preventMovement(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
for (Player player : getPlayers())
{
TutorialSession session = getTutorialSession(player);
long time = session.getElapsedTime();
if (time <= 10000) // 10 seconds
{
// player.teleport(getSpawn(session.getRegion()));
String secondsLeft = UtilTime.convertString(10000 - time, 0, UtilTime.TimeUnit.SECONDS);
setSpawnHologram(player,
getPoint(session.getRegion(), ClansMainTutorial.Point.SPAWN).add(0, 1.5, -3),
C.cGoldB + "Welcome to the Clans Tutorial!",
" ",
"This will teach you the basics of Clans.",
"It will take about 5 minutes to complete.",
"You must complete it before playing Clans.",
" ",
"Starting in " + C.cGreen + secondsLeft);
}
else if (!session.isRemovedHologram())
{
removeSpawnHologram(player);
player.setWalkSpeed(0.2F);
}
}
}
public void performGateCheck(Player player, DyeColor key)
{
if(player == null || !player.isOnline()) return;
@ -432,7 +482,7 @@ public class ClansMainTutorial extends Tutorial
return;
}
if (player.getLocation().distanceSquared(fence) <= (GATE_OPEN_DISTANCE * 2))
if (player.getLocation().distanceSquared(fence) <= (GATE_OPEN_DISTANCE * GATE_OPEN_DISTANCE))
{
// Within the correct blocks of the gates.
destroyFences(getRegion(player), key);
@ -463,4 +513,13 @@ public class ClansMainTutorial extends Tutorial
if(isInTutorial(event.getPlayer()))
event.setCancelled(true);
}
@EventHandler
public void energyBuy(PreEnergyShopBuyEvent event)
{
if (isInTutorial(event.getPlayer()))
{
event.setCancelled(true);
}
}
}

View File

@ -1,11 +1,35 @@
package mineplex.game.clans.tutorial.tutorials.clans.objective;
import mineplex.core.common.util.C;
import mineplex.game.clans.clans.siege.weapon.Cannon;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import mineplex.core.common.DefaultHashMap;
import mineplex.core.common.util.C;
import mineplex.core.common.util.EnclosedObject;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
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.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.siege.weapon.Cannon;
import mineplex.game.clans.tutorial.TutorialRegion;
import mineplex.game.clans.tutorial.TutorialSession;
import mineplex.game.clans.tutorial.objective.OrderedObjective;
import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial;
@ -15,27 +39,28 @@ import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.LoadCannonGoal;
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.MountCannonGoal;
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.StealEnemyPotatoesGoal;
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan.ClanInfoGoal;
import java.util.HashMap;
import java.util.Map;
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.ClanInfoGoal;
public class AttackEnemyObjective extends OrderedObjective<ClansMainTutorial>
{
private Map<String, Cannon> _cannon;
private DefaultHashMap<String, List<Zombie>> _shooters;
public AttackEnemyObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin)
{
super(clansMainTutorial, javaPlugin, "Enemy Clans", "Attack and raid this enemy!");
super(clansMainTutorial, javaPlugin, "Enemy Clans Tutorial", "Attack and raid this enemy!");
_cannon = new HashMap<>();
_shooters = new DefaultHashMap<>(username -> new ArrayList<>());
addGoal(new GetMapGoal(this));
addGoal(new HoldItemGoal(
this, Material.MAP,
"Identify Enemy on Map",
"Find the red square land on the map.",
"Find the Red Square on your Map.",
"Look at your map to help find where the Enemy Clan is. It's marked by " +
"a " + C.cRed + "red square" + C.mBody + ".",
"a " + C.cRed + "Red Square" + C.mBody + ".",
40
));
addGoal(new ClanInfoGoal(this));
@ -46,25 +71,135 @@ public class AttackEnemyObjective extends OrderedObjective<ClansMainTutorial>
setStartMessageDelay(60);
}
@Override
protected void customStart(Player player)
{
super.customStart(player);
TutorialSession session = getPlugin().getTutorialSession(player);
session.setMapTargetLocation(getPlugin().getCenter(session.getRegion(), ClansMainTutorial.Bounds.ENEMY_LAND));
addShooter("Chiss", getPlugin().getPoint(getPlugin().getRegion(player), ClansMainTutorial.Point.NPC_2), player);
addShooter("defek7", getPlugin().getPoint(getPlugin().getRegion(player), ClansMainTutorial.Point.NPC_1), player);
}
private void addShooter(String name, Location location, Player active)
{
System.out.println("Adding shooter " + _shooters.get(active.getName()).size() + 1);
Zombie shooter = location.getWorld().spawn(location.add(.5, 0, .8), Zombie.class);
shooter.setCustomName(name);
shooter.setCustomNameVisible(true);
UtilEnt.Vegetate(shooter);
shooter.teleport(location);
shooter.setHealth(shooter.getMaxHealth());
shooter.getEquipment().setItemInHand(new ItemStack(Material.BOW, 1));
shooter.getEquipment().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE, 1));
shooter.getEquipment().setBoots(new ItemStack(Material.GOLD_BOOTS, 1));
shooter.getEquipment().setHelmet(new ItemStack(Material.GOLD_HELMET, 1));
_shooters.get(active.getName()).add(shooter);
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() == UpdateType.FASTER)
{
for (Player player : getActivePlayers())
{
_shooters.get(player.getName()).forEach(shooter -> {
shooter.setHealth(shooter.getMaxHealth());
shooter.getEquipment().setItemInHand(new ItemStack(Material.BOW, 1));
shooter.getEquipment().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE, 1));
shooter.getEquipment().setBoots(new ItemStack(Material.GOLD_BOOTS, 1));
shooter.getEquipment().setHelmet(new ItemStack(Material.GOLD_HELMET, 1));
if (player.getLocation().distance(shooter.getLocation()) > 16)
{
return;
}
UtilEnt.LookAt(shooter, player.getEyeLocation());
if (Recharge.Instance.usable(player, "ShotBy" + shooter.getUniqueId().toString()))
{
Arrow arrow = shooter.shootArrow();
arrow.setVelocity(UtilAlg.getTrajectory(arrow.getLocation(), player.getEyeLocation()).multiply(1.6));
Recharge.Instance.use(player, "ShotBy" + shooter.getUniqueId().toString(), 500 + UtilMath.r(2000), false, false);
}
});
EnclosedObject<Boolean> kill = new EnclosedObject<>(Boolean.FALSE);
_shooters.get(player.getName()).forEach(shooter -> {
if (player.getLocation().distance(shooter.getLocation()) < 5)
{
kill.Set(Boolean.TRUE);
}
});
if (kill.Get().booleanValue())
{
_shooters.get(player.getName()).forEach(shooter -> {
UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, shooter.getLocation().add(0, .5, 0), new Vector(0d, 0d, 0d), 0.2f, 15, ViewDist.MAX, player);
UtilParticle.PlayParticle(ParticleType.SMOKE, shooter.getLocation().add(0, .5, 0), new Vector(0d, 0d, 0d), 0.2f, 15, ViewDist.MAX, player);
player.playSound(player.getLocation(), Sound.LAVA_POP, 1.0f, 1.0f);
shooter.remove();
});
_shooters.get(player.getName()).clear();
}
if (player.getHealth() <= 6)
{
player.setHealth(6);
}
}
}
}
@Override
protected void customLeave(Player player)
{
}
@Override
public void clean(Player player, TutorialRegion region)
{
super.clean(player, region);
System.out.println("Clearing shooters");
_shooters.get(player.getName()).forEach(shooter -> {
shooter.remove();
});
_shooters.get(player.getName()).clear();
}
@Override
protected void customFinish(Player player)
{
System.out.println("Clearing shooters");
_shooters.get(player.getName()).forEach(shooter -> {
shooter.remove();
});
_shooters.get(player.getName()).clear();
}
public Map<String, Cannon> getCannons() { return _cannon; }
public Map<String, Cannon> getCannons()
{
return _cannon;
}
}

View File

@ -13,7 +13,7 @@ public class ClanObjective extends OrderedObjective<ClansMainTutorial>
{
public ClanObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin)
{
super(clansMainTutorial, javaPlugin, "Clan Basics", "Create clan with /c create <name>");
super(clansMainTutorial, javaPlugin, "Clans Tutorial", "Create clan with /c create <name>");
addGoal(new LeaveSpawnGoal(this));
addGoal(new CreateClanGoal(this));

View File

@ -14,7 +14,7 @@ public class ClassesObjective extends OrderedObjective<ClansMainTutorial>
{
public ClassesObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin)
{
super(clansMainTutorial, javaPlugin, "Classes", "Learn to use our fully customizable classes");
super(clansMainTutorial, javaPlugin, "Classes Tutorial", "Learn to use our fully customizable classes");
addGoal(new EquipDefaultBuildGoal(this));
addGoal(new OpenClassManagerGoal(this));

View File

@ -13,7 +13,7 @@ public class EnergyObjective extends OrderedObjective<ClansMainTutorial>
{
public EnergyObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin)
{
super(clansMainTutorial, javaPlugin, "Energy", "A Clan requires Energy to maintain all of it's territory.");
super(clansMainTutorial, javaPlugin, "Energy Tutorial", "A Clan requires Energy to maintain all of it's territory.");
addGoal(new ExplainEnergyGoal(this));
addGoal(new BuyEnergyGoal(this));

View File

@ -18,14 +18,15 @@ public class FieldsObjective extends OrderedObjective<ClansMainTutorial>
{
public FieldsObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin)
{
super(clansMainTutorial, javaPlugin, "Fields", "Get various resources by mining for them in the fields");
super(clansMainTutorial, javaPlugin, "Fields Tutorial", "Get various resources by mining for them in the fields");
addGoal(new HoldItemGoal(
this,
Material.MAP,
"Identify Fields on Map",
"Find the Orange Striped Area on your map",
"Fields are marked by " + C.cGold + "Orange Stripes" + C.mBody + "."
"Find the Orange Striped Area on your Map",
"Fields are marked by " + C.cGold + "Orange Stripes" + C.mBody + ".",
80L
));
addGoal(new GoToFieldsGoal(this));
addGoal(new MineDiamondsGoal(this));

View File

@ -13,7 +13,7 @@ public class FinalObjective extends OrderedObjective<ClansMainTutorial>
{
public FinalObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin)
{
super(clansMainTutorial, javaPlugin, "Finishing", "Finalize your knowledge of Clans");
super(clansMainTutorial, javaPlugin, "Clans Tutorial 2", "Finalize your knowledge of Clans");
addGoal(new TpClanHomeGoal(this)); // IMPLEMENTED
addGoal(new DisbandClanGoal(this)); // IMPLEMENTED

View File

@ -21,7 +21,7 @@ public class PurchaseItemsObjective extends UnorderedObjective<ClansMainTutorial
{
public PurchaseItemsObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin)
{
super(clansMainTutorial, javaPlugin, "Purchase Items", "Purchase Items from Shop");
super(clansMainTutorial, javaPlugin, "Purchase Items Tutorial", "Purchase Items from Shop");
addGoal(new PurchaseGoal(
this,

View File

@ -33,7 +33,7 @@ public class ShopsObjective extends OrderedObjective<ClansMainTutorial>
public ShopsObjective(ClansMainTutorial clansMainTutorial, NpcManager npcManager, JavaPlugin javaPlugin)
{
super(clansMainTutorial, javaPlugin, "Shops", "Learn your way around our shops");
super(clansMainTutorial, javaPlugin, "Shops Tutorial", "Learn your way around our shops");
_npcMap = new HashMap<>();
_npcManager = npcManager;
@ -42,8 +42,9 @@ public class ShopsObjective extends OrderedObjective<ClansMainTutorial>
this,
Material.MAP,
"Identify Shops on Map",
"Find the Blue striped area on your map",
"Shops are marked on the map by the " + C.cDAqua + "Blue Stripes" + C.mBody + "."
"Find the Blue Striped Area on your map",
"Shops are marked on the map by the " + C.cDAqua + "Blue Stripes" + C.mBody + ".",
60L
));
addGoal(new GoToShopsGoal(this));
addGoal(new SellPotatoesGoal(this));

View File

@ -16,19 +16,20 @@ public class HoldItemGoal extends ObjectiveGoal<Objective<?, ?>>
{
private DefaultHashMap<String, EnclosedObject<Integer>> _ticksHeld = new DefaultHashMap<>(key -> new EnclosedObject<>(Integer.valueOf(0)));
private Material _material;
private long _holdTicks;
public HoldItemGoal(Objective<?, ?> objective, Material material, String name, String description, String helpText, int startDelay)
public HoldItemGoal(Objective<?, ?> objective, Material material, String name, String description, String helpText, int startDelay, long holdTicks)
{
super(objective, name, description, helpText, null);
_material = material;
_holdTicks = holdTicks;
// setStartMessageDelay(startDelay);
}
public HoldItemGoal(Objective<?, ?> objective, Material material, String name, String description, String helpText)
public HoldItemGoal(Objective<?, ?> objective, Material material, String name, String description, String helpText, long holdTicks)
{
this(objective, material, name, description, helpText, 120);
this(objective, material, name, description, helpText, 120, holdTicks);
}
@Override

View File

@ -29,8 +29,8 @@ public class BlowUpWallGoal extends ObjectiveGoal<AttackEnemyObjective>
super(
objective,
"Blow up the Enemy Base",
"Left-Click whilst sitting on the cannon to fire",
"This is the fun part. Use the Cannon to smash a hole in your enemys wall KA-BOOM!",
"Left-Click to shoot TNT at the Enemy Base",
"TNT Cannons will rotate to the direction you are looking. Simply look at the Enemy Base, wait for it to rotate, and then FIRE!",
DyeColor.MAGENTA
);
}
@ -106,7 +106,7 @@ public class BlowUpWallGoal extends ObjectiveGoal<AttackEnemyObjective>
}
else
{
UtilPlayer.message(shooter, F.main("Clans", "You missed! Try to hit the enemies front wall, that should make a nice big hole!"));
UtilPlayer.message(shooter, F.main("Clans", "You missed! Try to hit the enemy's front wall, that should make a nice big hole!"));
UtilInv.give(shooter, Material.TNT);
}

View File

@ -1,4 +1,4 @@
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan;
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy;
import mineplex.core.common.util.F;
@ -26,10 +26,10 @@ public class ClanInfoGoal extends ObjectiveGoal<AttackEnemyObjective>
super(
objective,
"Lookup Enemy Details",
"View info about the enemy clan by typing /c EnemyClan",
"View info about the enemy clan by typing '/c EnemyClan'",
"You can lookup details about your enemy before going for an " +
"attack! This can give you a crucial advantage before " +
"you begin.",
"you fight.",
null
);
}

View File

@ -19,9 +19,9 @@ public class GetMapGoal extends ObjectiveGoal<AttackEnemyObjective>
super(
objective,
"Get a Map",
"Get a Map ( Type /map )",
"Type '/map' to get a Map",
"You can get a Map any time you need one. The map will show you who " +
"owns the land around the map. Your clan is " + C.cAqua + "aqua" +
"owns the land around the map. Your clan is " + C.cAqua + "blue" +
C.mBody + ", your allies are " + C.cGreen + "green" + C.mBody + ", " +
"and your enemies are " + C.cRed + "red" + C.mBody + ".",
null

View File

@ -16,9 +16,8 @@ public class LoadCannonGoal extends ObjectiveGoal<AttackEnemyObjective>
super(
objective,
"Load the Cannon",
"Right click whilst sitting on the Cannon, and load it with TNT!",
"First youll need to load this baby up with some TNT. Right click whilst sitting " +
"on the Cannon, and load it with TNT!",
"Right-Click while on the Cannon, and insert your TNT",
"TNT Cannons require TNT to be able to shoot. You can also change the range your cannon fires in the Cannon Menu.",
null
);
}

View File

@ -26,9 +26,9 @@ public class MountCannonGoal extends ObjectiveGoal<AttackEnemyObjective>
super(
objective,
"Get on the Cannon",
"Right click on the Cannon to hop on!",
"To break through an enemy Clans fortress youll need some serious " +
"firepower. Try using this TNT Cannon to get the job done!",
"Right-Click on the Cannon",
"You cannot break blocks in enemy territory, however you can blow them up! "
+ "TNT Cannons are the best way to do destroy enemy bases!",
DyeColor.BLACK
);
}

View File

@ -32,9 +32,8 @@ public class StealEnemyPotatoesGoal extends ObjectiveGoal<AttackEnemyObjective>
super(
objective,
"Steal Potatoes",
"Retrieve the potatoes from the Enemy Clans base",
"Now that their walls are down, its time to get rich! Go steal their " +
"potatoes for your Clan!",
"Steal potatoes from the Enemy Clans base",
"Raiding enemy bases is one of the best parts of Clans! There's nothing better than looting Legendary weapons from enemies!",
DyeColor.PURPLE
);
}
@ -43,7 +42,7 @@ public class StealEnemyPotatoesGoal extends ObjectiveGoal<AttackEnemyObjective>
public String getDescription(Player player)
{
int count = _playersMap.get(player.getUniqueId()).get();
return "Retrieve the potatoes from the Enemy Clans base " + count + "/10";
return "Steal potatoes from the Enemy Clans base " + count + "/10";
}
@Override
@ -115,7 +114,7 @@ public class StealEnemyPotatoesGoal extends ObjectiveGoal<AttackEnemyObjective>
if (event.getItem().getItemStack().getType() == Material.POTATO_ITEM)
{
int count = _playersMap.get(event.getPlayer().getUniqueId()).getAndIncrement();
int count = _playersMap.get(event.getPlayer().getUniqueId()).incrementAndGet();
if (count == 10)
finish(event.getPlayer());
}

View File

@ -27,10 +27,10 @@ public class ClaimLandGoal extends ObjectiveGoal<ClanObjective>
super(
objective,
"Claim Land",
"Claim Land using the Clan Menu ( Type /c )",
"The first thing your Clan needs to do before you can start to " +
"build your fortress is claim the land in an area for your Clan. " +
"You must be inside the " + C.cAqua + "blue" + C.cGray + " outline to claim land.",
"Type '/c' to Claim Land using the Clan Menu",
"Clans are able to claim land for themselves. "
+ "Once claimed, no one else can break or place blocks there! "
+ "You must be inside the " + C.cAqua + "blue" + C.cGray + " outline to claim land.",
DyeColor.ORANGE
);
}

View File

@ -22,9 +22,8 @@ public class ClanManagementGoal extends ObjectiveGoal<ClanObjective>
super(
objective,
"Open the Clan Menu",
"Open the Clan Menu ( Type /c )",
"Clan Menu lets you view all clan information and perform actions such as: " +
"who is online, Claiming Land, Inviting Players and much more.",
"Type '/c' to open the Clan Menu",
"Clan Menu lets you do lots of Clans actions, and view information about your Clan. Take a moment to look at it all!",
null
);
}

View File

@ -18,7 +18,7 @@ public class CreateClanGoal extends ObjectiveGoal<ClanObjective>
super(
objective,
"Create a Clan",
"Type /c create <name> to create a new Clan",
"Type '/c create <name>' to create a new Clan",
F.elem("Clans") + " are groups of players that can claim land, build fortresses, " +
"and fight epic battles. Together they will challenge other clans for " +
"control of the land.",

View File

@ -23,17 +23,17 @@ public class LeaveSpawnGoal extends ObjectiveGoal<ClanObjective>
{
super(
objective,
"Leave Spawn",
"Leave Spawn Island",
"Jump off Spawn Island",
F.elem("Spawn Island") + " is where you will respawn when you die. This area is " +
"a " + F.elem("Safe Zone") + ", meaning that players cannot hurt each other. " +
"From here, you can teleport to various places, as well as read some helpful " +
"hints. To leave " + F.elem("Spawn Island") + ", simply jump off!",
"hints.",
DyeColor.WHITE
);
// 2 seconds after start message
// setStartMessageDelay(20 * 3);
setStartMessageDelay(20 * 11);
}
@Override

View File

@ -22,10 +22,9 @@ public class SetHomeGoal extends ObjectiveGoal<ClanObjective>
super(
objective,
"Set Clan Home",
"Set your Clan's Home ( Type /c sethome )",
"Type '/c sethome' to set your Clan's Home",
"Your Clan Home is a special place in your base that you can teleport " +
"to from " + F.elem("Spawn Island") + ". You can teleport to it " +
"at any time by typing " + F.elem("/c home") + ".",
"to from " + F.elem("Spawn Island") + " or at any time by typing " + F.elem("/c home") + ".",
DyeColor.ORANGE
);

View File

@ -20,7 +20,7 @@ public class OpenClassManagerGoal extends ObjectiveGoal<ClassesObjective>
objective, "Open Class Manager",
"Right-Click on the Enchantment Table",
"Each class has lots of different skills, and you can pick which ones you want to " +
"equip! Click on an " + F.elem("Enchanting Table") + " to have a look at " +
"equip! Right-Click on an " + F.elem("Enchanting Table") + " to have a look at " +
"this menu.",
DyeColor.CYAN
);

View File

@ -21,7 +21,7 @@ public class UseBullsChargeGoal extends ObjectiveGoal<ClassesObjective> {
super(
objective,
"Use Bulls Charge",
"Right-Click with Axe to use Bull's Charge",
"Right-Click with Axe to use Bulls Charge",
"One of your default abilities as Knight is Bulls Charge. This ability will make " +
"you run faster for a short time, and deal extra damage to enemies.",
null

View File

@ -48,7 +48,6 @@ public class BuyEnergyGoal extends ObjectiveGoal<EnergyObjective>
{
if (contains(event.getPlayer()))
{
event.setCancelled(true);
finish(event.getPlayer());
event.getPlayer().closeInventory();
}

View File

@ -19,8 +19,8 @@ public class ExplainEnergyGoal extends ObjectiveGoal<EnergyObjective>
{
super(
objective,
"About Energy",
"Look at your energy in your Clans Menu ( Type /c )",
"Check your Clans Energy",
"Type '/c' to check your Clans Energy",
"Owning land isnt free! You will need to buy Energy from the Shops to retain " +
"ownership of it. If your Clan Energy ever reaches 0, you will lose your " +
"land claims!",

View File

@ -1,58 +0,0 @@
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.fields;
import java.util.UUID;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDeathEvent;
import mineplex.core.common.DefaultHashMap;
import mineplex.game.clans.tutorial.objective.Objective;
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
public class KillZombiesGoal extends ObjectiveGoal
{
private DefaultHashMap<UUID, Integer> _kills = new DefaultHashMap<>(uuid -> 0);
public KillZombiesGoal(Objective objective)
{
super(objective, "Kill Zombies", "Kill a few zombies in the Fields.");
}
@Override
protected void customStart(Player player)
{
}
@Override
protected void customFinish(Player player)
{
}
@EventHandler
public void entityKilled(EntityDeathEvent event)
{
if (event.getEntityType() != EntityType.ZOMBIE)
{
return;
}
if (event.getEntity().getKiller() == null)
{
return;
}
if (!contains(event.getEntity().getKiller()))
{
return;
}
_kills.put(event.getEntity().getKiller().getUniqueId(), Integer.valueOf(_kills.get(event.getEntity().getKiller().getUniqueId()).intValue() + 1));
if (_kills.get(event.getEntity().getKiller().getUniqueId()).intValue() >= 2)
{
finish(event.getEntity().getKiller());
}
}
}

View File

@ -29,7 +29,7 @@ public class MineDiamondsGoal extends ObjectiveGoal<FieldsObjective>
super(
objective,
"Mine Diamonds",
"Search for some diamonds in the Fields and mine them",
"Mine Diamonds in the Fields",
"Mining in the Fields is a great way to make lots of money! The ores will " +
"regenerate over time. Be careful of enemies though!",
DyeColor.LIME

View File

@ -22,10 +22,9 @@ public class DisbandClanGoal extends ObjectiveGoal<FinalObjective>
super(
objective,
"Disband Clan",
"Disband your Clan ( Type /c )",
"Type '/c' and Disband your Clan",
"Now that the tutorial is almost finished, lets delete your Clan. Disbanding a " +
"Clan will delete it, and unclaim all of your land. Open the Clans Menu " +
"and do this now.",
"Clan will delete it, and unclaim all of your land.",
null
);
}

View File

@ -22,8 +22,8 @@ public class TpClanHomeGoal extends ObjectiveGoal<FinalObjective>
super(
objective,
"Teleport to Clan Home",
"Teleport back to your Clan Home ( Type /c home )",
"You can teleport back to your Clan Home at any time, as long as it's set!",
"Type '/c home' to teleport to Clan Home",
"You can teleport back to your Clan Home at any time! If enemies break your bed, then you cannot teleport to it!",
null
);

View File

@ -8,6 +8,7 @@ import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
import mineplex.core.common.util.UtilPlayer;
@ -23,8 +24,9 @@ public class GoToShopsGoal extends ObjectiveGoal<ShopsObjective>
super(
objective,
"Go to the Shops",
"Head over to the Shops (use your map)",
"The shops are the place where you can buy and sell all sorts of items!",
"Walk to the Shops",
"The shops are the place where you can buy and sell all sorts of items! "
+ "The Shops are a " + F.elem("Safe Zone") + ", meaning meaning that players cannot hurt each other.",
DyeColor.LIGHT_BLUE
);
}

View File

@ -51,7 +51,6 @@ public class PurchaseGoal extends ObjectiveGoal
if (contains(event.getPlayer()) && event.getMaterial() == _material)
{
event.setBuyPrice(0);
event.setSellPrice(0);
}
}

View File

@ -22,10 +22,9 @@ public class SellPotatoesGoal extends ObjectiveGoal<ShopsObjective>
super(
objective,
"Sell Potatoes",
"Sell your Potatoes to the " + F.elem("Organic Produce Shop NPC") + ".",
"Sell your Potatoes to the " + F.elem("Organic Produce Shop"),
"Farming is a great way to make money in Clans. Build a farm in your land, " +
"harvest " +
"the crops and sell it to the shops for profit!",
"harvest the crops, and sell it to the shops for profit!",
DyeColor.PINK
);
}

View File

@ -263,11 +263,11 @@ public abstract class WorldEvent implements Listener, ScoreboardElement
HandlerList.unregisterAll(creature);
_creatures.remove(creature);
}
public void announceStart()
{
UtilTextMiddle.display(C.cGreen + getName(), UtilWorld.locToStrClean(getCenterLocation()), 10, 100, 40);
UtilServer.broadcast(F.main("Event", F.elem(getName()) + " has started at coordinates " + F.elem(UtilWorld.locToStrClean(getCenterLocation()))));
}