Merge remote-tracking branch 'refs/remotes/origin/develop' into feature/gem-hunters-persistence

This commit is contained in:
Sam 2017-04-21 17:42:46 +01:00
commit ac3c1c3ebb
110 changed files with 4443 additions and 707 deletions

View File

@ -65,6 +65,8 @@ public class SkinData
public final static SkinData GINGERBREAD = new SkinData("eyJ0aW1lc3RhbXAiOjE0ODAxOTk5MjM0NTUsInByb2ZpbGVJZCI6IjRjOGQ1NjllZWZlMTRkOGE4YzJmMmM4ODA3ODA3ODRmIiwicHJvZmlsZU5hbWUiOiJHaW5nZXJicmVhZE1hbiIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzAyM2IxZGQ5MWQyYjM2Y2FkZTU2NjVjM2Y3ODk3ZmNiOGRlMWFlNjE5YTRlOTYxODU2MzdiMTliZGNmZjQ3In19fQ==", "lND5lQCzd5DKdn+ps82zn55hrSDr12bBLFoSbxetOj7MaYAuHCkJPQQOXdcMh3TLLSgxmQzEWkIHSUo760/2Qfd2uDDOTVfZZqiFjiOwDQ7YQjkokqNaC3U9gEq+LBJ+IgEkwaCsluXYMIK0Wvqx1DFa82pg8bSYGczJfTw/1kQsUUTpmao6ChZw3yrHTPow38onD95f9i6yVcnhSpPfM/JTQuL4N6Jdcql6VRJNSvCHJvEgh6R2p0w7DJhEGIzkFaF3lPdBqw+Mm97fBPvznscd4s6gpH07gUl/T+vlyHyRBLm85Pgm70r4MQ+c/nGOQOXzFMNpO8RIot/uhd7t3bvSi6yFzZQm7P9QLCLm/0C84x0sCugjeN/hVA347FWnuRPcya5xPzlpTWAW7pCjheAz0mvnPUMYT6Wp4CJx6bPdePnaiLFSeK8EyQIU9IUQJgXqMA3cOwqMBdh/0r71fTInPdgXsVxabmGbCgIuK3A2hSgxpcZv9412T0NIJYSTi0s2B3dyAaZJrdF5wa1hIr8au63SWFJww3GEEOF5YObEyVvKj2yS40iaHaRrfn1DeALT0eD0oN1zzK66FKbFuDmZmm4Thel9gKt+QcnR2uHlFLEBUogpIXyeC8zca7SOppANloOpO4mBbf22dXBJogenVd425JWaXOHJ6NVqIBw="); public final static SkinData GINGERBREAD = new SkinData("eyJ0aW1lc3RhbXAiOjE0ODAxOTk5MjM0NTUsInByb2ZpbGVJZCI6IjRjOGQ1NjllZWZlMTRkOGE4YzJmMmM4ODA3ODA3ODRmIiwicHJvZmlsZU5hbWUiOiJHaW5nZXJicmVhZE1hbiIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzAyM2IxZGQ5MWQyYjM2Y2FkZTU2NjVjM2Y3ODk3ZmNiOGRlMWFlNjE5YTRlOTYxODU2MzdiMTliZGNmZjQ3In19fQ==", "lND5lQCzd5DKdn+ps82zn55hrSDr12bBLFoSbxetOj7MaYAuHCkJPQQOXdcMh3TLLSgxmQzEWkIHSUo760/2Qfd2uDDOTVfZZqiFjiOwDQ7YQjkokqNaC3U9gEq+LBJ+IgEkwaCsluXYMIK0Wvqx1DFa82pg8bSYGczJfTw/1kQsUUTpmao6ChZw3yrHTPow38onD95f9i6yVcnhSpPfM/JTQuL4N6Jdcql6VRJNSvCHJvEgh6R2p0w7DJhEGIzkFaF3lPdBqw+Mm97fBPvznscd4s6gpH07gUl/T+vlyHyRBLm85Pgm70r4MQ+c/nGOQOXzFMNpO8RIot/uhd7t3bvSi6yFzZQm7P9QLCLm/0C84x0sCugjeN/hVA347FWnuRPcya5xPzlpTWAW7pCjheAz0mvnPUMYT6Wp4CJx6bPdePnaiLFSeK8EyQIU9IUQJgXqMA3cOwqMBdh/0r71fTInPdgXsVxabmGbCgIuK3A2hSgxpcZv9412T0NIJYSTi0s2B3dyAaZJrdF5wa1hIr8au63SWFJww3GEEOF5YObEyVvKj2yS40iaHaRrfn1DeALT0eD0oN1zzK66FKbFuDmZmm4Thel9gKt+QcnR2uHlFLEBUogpIXyeC8zca7SOppANloOpO4mBbf22dXBJogenVd425JWaXOHJ6NVqIBw=");
public final static SkinData LOVE_DOCTOR = new SkinData("eyJ0aW1lc3RhbXAiOjE0ODQ0MzM1MjQxMjAsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9iY2RiZTM2OTM1NGZjMzUxY2RhNGRmY2Y2OWM0MzY3ODcwYjI4ZWE3NDUzYWVjM2IzMjgyM2YyMWMzNTJlNTUifX19", "KD0NsKFlS+9/JpPQdT0Lq2jo942WeHpFevJPR3T9JO/5NVmNprupsWuTgepw14iHoax8/xyP8S4XksYq8hJ30e+gRKXVReqtq4l8JetXJILI7JTL6EHj/Flg4t0O6ASIm3Hr+w86IKrPb0NwHTjHJHvbf0r7k3E/TMLbq0/c7Xgi+JgC0uQd+wIPZhQe92P3O7eGH858X0vsxG0FVzgnEAlHVLmqBCwqxMU5CsBp0JCTVIbtp+JNmveCsfLagP6mi39rUudbueXJQgqLv7H7Zw+ZNINLLaKPNVO6Od8sX3c+CSUQ+Bm9bakYr628k/z0krTdNpLG7OGXWoT3XShW6HXB/z7o7hpuDXJW7HdyvmWv9GVyWLm2USNe7/3Ugs2zWZI1f+t6t+V3EVr3T+nR4zpY/ISdlTsLtV/Daebr0v/V0YlaM0UaASzz16ob3p1cfao7C7BZwKqOBKoSyHpnuLhd70wOtNrhhPDU9dWQBC/l6uojcMJ9lQMsxFmHj4JFqJYl7p/UXnq1vnYBo1P3A//IGl4gL1Hv8U0I14LT77/AMYH57mItgD0/VnE4bvPIFML/4cX7L9qpdLoOAAyfa5P9cAfzhUnVnRRLM016MpGtvY8SfbZ68Of1Xjz/dZ9/fBEcObXPHGX2QNuJRFiWJjRVKjO7ok0qfiVUEmuZr6I="); public final static SkinData LOVE_DOCTOR = new SkinData("eyJ0aW1lc3RhbXAiOjE0ODQ0MzM1MjQxMjAsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9iY2RiZTM2OTM1NGZjMzUxY2RhNGRmY2Y2OWM0MzY3ODcwYjI4ZWE3NDUzYWVjM2IzMjgyM2YyMWMzNTJlNTUifX19", "KD0NsKFlS+9/JpPQdT0Lq2jo942WeHpFevJPR3T9JO/5NVmNprupsWuTgepw14iHoax8/xyP8S4XksYq8hJ30e+gRKXVReqtq4l8JetXJILI7JTL6EHj/Flg4t0O6ASIm3Hr+w86IKrPb0NwHTjHJHvbf0r7k3E/TMLbq0/c7Xgi+JgC0uQd+wIPZhQe92P3O7eGH858X0vsxG0FVzgnEAlHVLmqBCwqxMU5CsBp0JCTVIbtp+JNmveCsfLagP6mi39rUudbueXJQgqLv7H7Zw+ZNINLLaKPNVO6Od8sX3c+CSUQ+Bm9bakYr628k/z0krTdNpLG7OGXWoT3XShW6HXB/z7o7hpuDXJW7HdyvmWv9GVyWLm2USNe7/3Ugs2zWZI1f+t6t+V3EVr3T+nR4zpY/ISdlTsLtV/Daebr0v/V0YlaM0UaASzz16ob3p1cfao7C7BZwKqOBKoSyHpnuLhd70wOtNrhhPDU9dWQBC/l6uojcMJ9lQMsxFmHj4JFqJYl7p/UXnq1vnYBo1P3A//IGl4gL1Hv8U0I14LT77/AMYH57mItgD0/VnE4bvPIFML/4cX7L9qpdLoOAAyfa5P9cAfzhUnVnRRLM016MpGtvY8SfbZ68Of1Xjz/dZ9/fBEcObXPHGX2QNuJRFiWJjRVKjO7ok0qfiVUEmuZr6I=");
public final static SkinData LEPRECHAUN = new SkinData("eyJ0aW1lc3RhbXAiOjE0ODc4NzI5Mjg1ODIsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS80ZTBkZjZhZGNiNzkzMzM5ZjFhOGNkM2E0ZGQ2ZThjNGQ2ZWFjYmU5NWMzZDA5OTI4NDMyMWFiZGI5MTgwOSJ9fX0=", "cyIYHTdzvVBOyYoiJZTvNS8Et5pzqBNxuz6GQspE2lBkW2Bj82JNv5oczsf3oxYAG4zxdb96G8+7UKBmoJdvx0x6UD7Dk0dnKrwpXfOhe+jRxtwMGMsdYCb8URWaoIoeKpxdCmAtjgV6FI8zDy2Yzi+MF4O9e4VqH0tMBoD2/CZScQwNEzc4YXf2M2fglKn9uK2+xrgLV+XS+SNdIn7BRiNlQf96u6N2G0lO+eb09LbIfIgAgfnyLiARccWa+VNo6gwlCFyRMnwOlgqxL5XA5Um4kkx2ZReRRCDFQ4NV5eLBktLd5wpECyOuY7v7S3zLqwbhwG47gS8hnXqmtHG5RW0RUQZEryg638Cw7hwr2k09iStfok8WeZUIJ+fuUWgdArvbtN36a2pCXyFdqzp+E8xzSF4E9SQv0K+1lNj+w4L58dh8pddeKK8m5bpjINj4xZ6nf7reWYQAX/imVNYTXTW8JqYnF+++xViBwmfeeM3PmEg+wyTduh+M25nyhGcqn5l+UyQ9aMzzdNs2aEdx12fOm1sOFXjHrHWeo6ciEm7sY1SDjiJ99VVXuGHCJWBtxq/B+c+vC/Cj8itEYOetwe5NKrgI99pZjG+KiRr4L0n8/NA3Px7SbKUUpHse80pNMjGfFW4pAOyFXJaKHrObWT2iL2AnTe+yfdY4sf/JZT4="); public final static SkinData LEPRECHAUN = new SkinData("eyJ0aW1lc3RhbXAiOjE0ODc4NzI5Mjg1ODIsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS80ZTBkZjZhZGNiNzkzMzM5ZjFhOGNkM2E0ZGQ2ZThjNGQ2ZWFjYmU5NWMzZDA5OTI4NDMyMWFiZGI5MTgwOSJ9fX0=", "cyIYHTdzvVBOyYoiJZTvNS8Et5pzqBNxuz6GQspE2lBkW2Bj82JNv5oczsf3oxYAG4zxdb96G8+7UKBmoJdvx0x6UD7Dk0dnKrwpXfOhe+jRxtwMGMsdYCb8URWaoIoeKpxdCmAtjgV6FI8zDy2Yzi+MF4O9e4VqH0tMBoD2/CZScQwNEzc4YXf2M2fglKn9uK2+xrgLV+XS+SNdIn7BRiNlQf96u6N2G0lO+eb09LbIfIgAgfnyLiARccWa+VNo6gwlCFyRMnwOlgqxL5XA5Um4kkx2ZReRRCDFQ4NV5eLBktLd5wpECyOuY7v7S3zLqwbhwG47gS8hnXqmtHG5RW0RUQZEryg638Cw7hwr2k09iStfok8WeZUIJ+fuUWgdArvbtN36a2pCXyFdqzp+E8xzSF4E9SQv0K+1lNj+w4L58dh8pddeKK8m5bpjINj4xZ6nf7reWYQAX/imVNYTXTW8JqYnF+++xViBwmfeeM3PmEg+wyTduh+M25nyhGcqn5l+UyQ9aMzzdNs2aEdx12fOm1sOFXjHrHWeo6ciEm7sY1SDjiJ99VVXuGHCJWBtxq/B+c+vC/Cj8itEYOetwe5NKrgI99pZjG+KiRr4L0n8/NA3Px7SbKUUpHse80pNMjGfFW4pAOyFXJaKHrObWT2iL2AnTe+yfdY4sf/JZT4=");
public final static SkinData BUGS_BUNNY = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTA0NzE5MDU2MTgsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84MmUyMjRkMGJkZGJmNjRiODIzMmUxNWRhNGRkN2NjN2NiYTYzM2NiODkyMTFhYjVjNDRhODU0ZjM1NDhlZWRiIn19fQ==", "QtM7YGNpqGcTnlUCTtQsQIEc8VGvL8cxWzAvN4LjYZrY4Fv15ysEVSPWPmRL/FJTRyUFCrJFO/0miVbuIEsGyUnsgHJAr9qkeyMvfD3+pZtKU1FkS58VNQkL/YaPDms7XPy1BPNo+ynQnVevdVCNDOvs2244Px3UljtuReBteKqL8QGMR1K6FFCQuKKvcvYsljdM8RV91r2yuT9UDxnzMRghWyRZuthvCeGL85g1LQxCnzJ0NUqIqCDrTWa8jeuncLnmRooKZYGsQjCAVOSFRk4KytD+fv8xgNK2igqBgVcqAINl5IjrFt7yyPQ2FVBbshETsjewusa6eZSBoy1Lc17G7bcndoOdwGMuztLjHPMzxFpIV1RkbZrngjcSTE/IQdSw79NlzMOEMKjE/34M7xcSnSZA1xwW33g+/xq+pNbqcXu85e7VXkziWDhHREp9ITT4YjrVdrss1yfYBzZgRmmLyaMpVmVsecKB9adpuZkhGzKIVrQHDGYEHoqoRnsRGJREdZQPxaSWp4+DSxpV/0oJXJWDz+XFztbcVbBcjBOD9kpFP0s+R5t1WA2B+jsf9J3LdsUUDbBiWikBwbAXKhHxTWWKv6OZLZovhgvGnW2lXQsHglEKuD7jE/mnFj4SF2qRO2N37AUjaG8AGQtTVhxW5JneIiBA0dbKIk06yoY=");
public final static SkinData SLENDERMAN = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTA0NzUyNzk4NTUsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9hMWNkOTI5OTFmYTRjZGQ2MGVlZDNhZTM3ZmI5NWRmZjFkNWNkOGNiZmYwYWFjMzE4MmQ0ODU2NDU5NTIzYyJ9fX0=", "OVqWFLCekyZcdGli6kPBKNh8/VYPhKZGNqlAvSOKc3RLgh4pIkI6TDPr/Y+VQdhz1wZozARFYSeoDJJJ4nZTi7gi3rVPG2rL1ZnKo7so5hdT8caEzSTRmgwPKzo03ZhEEsW9AEJo9mpiUxGSJdBlgEb9UgodpYFW1IjRC09CcBUqzRWP8QGZTSFSN5x9emQ97DyiFmt0NFWubHCKHdb7CExhchPRtbahL3hOEzPY8/Y+Irl9OZjx7jONE7O/sYItCuZoXc3FaTgCV0riiXHCgH2eA54s5TQVWumtp3FU7VIcKR6pm/o61+GusvqhNgdFNk9XSHWMUyp+HNU0R8sConZQN/eaVx9laJmUUb4zNZ7hX/hLYV+r9LFU1NXOeIZWJPShD+bYfZgEorIpD+EAL4BHht/f5e6a1IZUDBWb001PFibby2t9WWjoDVKz4McbxZ2Xui7EHKFG1K3biPibhWx6fvnOeJ2xW6UDIZcD+TCXwlW/knkFt44Xpyv3oNHk3UNkyrQgghd6qkc3gZHxP8PQCNvKIyK1I+pHR6JMZvSStp7ZQRDpvsvIUyOJvq+7Bs7lFYs8hcJHMzEB+8PYlH2k7P7iLuA6ZYFUmvOW1LLq0+hvxK96ZdNEsJdmMkVVTZBRw7vsZ4GPbkdp2cMOFH2lHcQj80xKqVbd43IqFDA=");
// Comments this out for now, so it doesn't load the player profile // Comments this out for now, so it doesn't load the player profile
// A better way to do this would check for the properties when getting the skull or the skin // A better way to do this would check for the properties when getting the skull or the skin

View File

@ -58,6 +58,11 @@ public class F
return C.mElem + elem + C.mBody; return C.mElem + elem + C.mBody;
} }
public static String count(int elem)
{
return count(String.valueOf(elem));
}
public static String count(String elem) public static String count(String elem)
{ {
return C.mCount + elem + C.mBody; return C.mCount + elem + C.mBody;

View File

@ -7,6 +7,16 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.Blocks;
import net.minecraft.server.v1_8_R3.IBlockData;
import net.minecraft.server.v1_8_R3.Item;
import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.MinecraftKey;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.TileEntityFlowerPot;
import net.minecraft.server.v1_8_R3.WorldServer;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.SkullType; import org.bukkit.SkullType;
@ -35,15 +45,6 @@ import com.mojang.authlib.GameProfile;
import mineplex.core.common.Pair; import mineplex.core.common.Pair;
import mineplex.core.common.block.MultiBlockUpdaterAgent; import mineplex.core.common.block.MultiBlockUpdaterAgent;
import mineplex.core.common.skin.SkinData; import mineplex.core.common.skin.SkinData;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.Blocks;
import net.minecraft.server.v1_8_R3.IBlockData;
import net.minecraft.server.v1_8_R3.Item;
import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.MinecraftKey;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.TileEntityFlowerPot;
import net.minecraft.server.v1_8_R3.WorldServer;
public class UtilBlock public class UtilBlock
{ {
@ -395,6 +396,16 @@ public class UtilBlock
return blockUseSet.contains(block); return blockUseSet.contains(block);
} }
public static Set<Block> getBlocksInRadius(Location loc, double radius)
{
return getInRadius(loc, radius).keySet();
}
public static Set<Block> getBlocksInRadius(Location loc, double radius, int maxHeight)
{
return getInRadius(loc, radius, maxHeight).keySet();
}
public static HashMap<Block, Double> getInRadius(Location loc, double dR) public static HashMap<Block, Double> getInRadius(Location loc, double dR)
{ {
return getInRadius(loc, dR, 9999); return getInRadius(loc, dR, 9999);

View File

@ -43,7 +43,7 @@
<dependency> <dependency>
<groupId>com.mineplex</groupId> <groupId>com.mineplex</groupId>
<artifactId>anticheat</artifactId> <artifactId>anticheat</artifactId>
<version>1.3</version> <version>1.5</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.tukaani</groupId> <groupId>org.tukaani</groupId>

View File

@ -57,6 +57,13 @@ public enum Achievement
new int[]{200}, new int[]{200},
AchievementCategory.HOLIDAY), AchievementCategory.HOLIDAY),
GLOBAL_EGG_HUNTER_2017("2017 Egg Hunter", 4000,
new String[]{"Global.Easter Eggs 2017"},
new String[]{"Find 200 Easter Egg Baskets,",
"during Easter 2017"},
new int[]{200},
AchievementCategory.HOLIDAY),
//Bridges //Bridges
BRIDGES_WINS("Bridge Champion", 600, BRIDGES_WINS("Bridge Champion", 600,
new String[]{"The Bridges.Wins"}, new String[]{"The Bridges.Wins"},

View File

@ -209,7 +209,7 @@ public enum AchievementCategory
StatDisplay.fromGame("Wins", GameDisplay.SkyfallTeams, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.SkyfallTeams, "Wins", "Losses"), StatDisplay.fromGame("Wins", GameDisplay.SkyfallTeams, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.SkyfallTeams, "Wins", "Losses"),
StatDisplay.fromGame("Kills", GameDisplay.SkyfallTeams, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.SkyfallTeams, "Deaths"), StatDisplay.fromGame("Kills", GameDisplay.SkyfallTeams, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.SkyfallTeams, "Deaths"),
StatDisplay.fromGame("Gems Earned", GameDisplay.SkyfallTeams, "GemsEarned"), null, StatDisplay.fromGame("Booster Rings", GameDisplay.SkyfallTeams, "Rings")}, StatDisplay.fromGame("Gems Earned", GameDisplay.SkyfallTeams, "GemsEarned"), null, StatDisplay.fromGame("Booster Rings", GameDisplay.SkyfallTeams, "Rings")},
Material.BOW, 0, GameCategory.SURVIVAL, null, false, GameDisplay.Skyfall.getGameId(), GameDisplay.SkyfallTeams.getGameId()); Material.DIAMOND_BOOTS, 0, GameCategory.SURVIVAL, null, false, GameDisplay.Skyfall.getGameId(), GameDisplay.SkyfallTeams.getGameId());
private String _name; private String _name;
private String[] _statsToPull; private String[] _statsToPull;

View File

@ -208,9 +208,6 @@ public class AchievementManager extends MiniPlugin
return level; return level;
} }
if (sender.getName().equalsIgnoreCase("B2_mp"))
return 101;
if (rank.has(Rank.MODERATOR)) if (rank.has(Rank.MODERATOR))
level = Math.max(level, 5); level = Math.max(level, 5);
if (rank.has(Rank.SNR_MODERATOR)) if (rank.has(Rank.SNR_MODERATOR))
@ -222,9 +219,6 @@ public class AchievementManager extends MiniPlugin
if (rank.has(Rank.OWNER)) if (rank.has(Rank.OWNER))
level = Math.max(level, 50 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel()); level = Math.max(level, 50 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
if (sender.getName().equalsIgnoreCase("Phinary"))
level = 0;
return level; return level;
} }

View File

@ -1,5 +1,6 @@
package mineplex.core.antihack; package mineplex.core.antihack;
import javax.xml.bind.DatatypeConverter;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
@ -9,7 +10,11 @@ import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.Consumer; import java.util.function.Consumer;
import javax.xml.bind.DatatypeConverter; import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -43,6 +48,7 @@ import com.mineplex.anticheat.checks.combat.KillauraTypeF;
import com.mineplex.anticheat.checks.move.Glide; import com.mineplex.anticheat.checks.move.Glide;
import com.mineplex.anticheat.checks.move.HeadRoll; import com.mineplex.anticheat.checks.move.HeadRoll;
import com.mineplex.anticheat.checks.move.Speed; import com.mineplex.anticheat.checks.move.Speed;
import com.mineplex.anticheat.checks.move.Toggle;
import com.mineplex.anticheat.checks.player.BadPackets; import com.mineplex.anticheat.checks.player.BadPackets;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
@ -76,37 +82,34 @@ import mineplex.core.punish.Category;
import mineplex.core.punish.Punish; import mineplex.core.punish.Punish;
import mineplex.core.punish.PunishmentResponse; import mineplex.core.punish.PunishmentResponse;
import mineplex.serverdata.commands.ServerCommandManager; import mineplex.serverdata.commands.ServerCommandManager;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
@ReflectivelyCreateMiniPlugin @ReflectivelyCreateMiniPlugin
public class AntiHack extends MiniPlugin public class AntiHack extends MiniPlugin
{ {
private static final Map<Class<? extends Check>, CheckThresholds> CHECKS = ImmutableMap.<Class<? extends Check>, CheckThresholds>builder() private static final Map<Class<? extends Check>, CheckThresholds> CHECKS = ImmutableMap.<Class<? extends Check>, CheckThresholds>builder()
.put(KillauraTypeA.class, new CheckThresholds("Kill Aura", 0, 25, 50)) .put(KillauraTypeA.class, new CheckThresholds("Kill Aura", 25, 45, 60))
.put(KillauraTypeB.class, new CheckThresholds("High CPS", 0, 0, Integer.MAX_VALUE)) .put(KillauraTypeB.class, new CheckThresholds("High CPS", 0, 0, Integer.MAX_VALUE))
.put(KillauraTypeC.class, new CheckThresholds("Reach", 0, Integer.MAX_VALUE, Integer.MAX_VALUE)) .put(KillauraTypeC.class, new CheckThresholds("Reach", 25, Integer.MAX_VALUE, Integer.MAX_VALUE))
.put(KillauraTypeD.class, new CheckThresholds("Kill Aura", 500, 1000, 1500)) .put(KillauraTypeD.class, new CheckThresholds("Kill Aura", 500, 1000, 1500))
.put(KillauraTypeE.class, new CheckThresholds("Kill Aura", 300, 700, 2000)) .put(KillauraTypeE.class, new CheckThresholds("Kill Aura", 1000, 2000, 5000))
.put(KillauraTypeF.class, new CheckThresholds("Kill Aura", 150, 250, 350)) .put(KillauraTypeF.class, new CheckThresholds("Kill Aura", 200, 300, 400))
.put(BadPackets.class, new CheckThresholds("Regen", 500, 1000, 2000)) .put(BadPackets.class, new CheckThresholds("Regen", 500, 1000, 2000))
.put(Glide.class, new CheckThresholds("Flying", 150, 250, 500)) .put(Glide.class, new CheckThresholds("Flying", 1000, 2000, 3500))
.put(Speed.class, new CheckThresholds("Speed", 150, 250, 500)) .put(Speed.class, new CheckThresholds("Speed", 1000, 2000, 3500))
.put(HeadRoll.class, new CheckThresholds("Illegal Movement", 0, 0, 0)) .put(HeadRoll.class, new CheckThresholds("Illegal Movement", 0, 0, 1000))
.put(Toggle.class, new CheckThresholds("AutoSneak", 100, 200, 300))
.build(); .build();
private static final CheckThresholds NOOP_THRESHOLD = new CheckThresholds("Unknown", 0, Integer.MAX_VALUE, Integer.MAX_VALUE); private static final CheckThresholds NOOP_THRESHOLD = new CheckThresholds("Unknown", Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
private static final Map<Class<? extends Check>, AntiHackAction> ACTIONS = ImmutableMap.<Class<? extends Check>, AntiHackAction>builder() private static final Map<Class<? extends Check>, AntiHackAction> ACTIONS = ImmutableMap.<Class<? extends Check>, AntiHackAction>builder()
.put(KillauraTypeA.class, new ImmediateBanAction(200)) .put(KillauraTypeA.class, new ImmediateBanAction(200))
.put(KillauraTypeD.class, new BanwaveAction(1500)) .put(KillauraTypeD.class, new BanwaveAction(1500))
.put(KillauraTypeF.class, new BanwaveAction(600))
.put(Glide.class, new ImmediateBanAction(10000)) .put(Glide.class, new ImmediateBanAction(10000))
.put(Speed.class, new ImmediateBanAction(10000)) .put(Speed.class, new ImmediateBanAction(10000))
// .put(HeadRoll.class, new ImmediateBanAction(200)) .put(HeadRoll.class, new ImmediateBanAction(2000))
.put(HeadRoll.class, new GEPBanAction(1)) .put(Toggle.class, new ImmediateBanAction(500))
.put(BadPackets.class, new GEPBanAction(300)) .put(BadPackets.class, new GEPBanAction(300))
.put(KillauraTypeB.class, new GEPBanAction(100)) .put(KillauraTypeB.class, new GEPBanAction(100))
.build(); .build();
@ -368,8 +371,6 @@ public class AntiHack extends MiniPlugin
ACTIONS.getOrDefault(event.getCheckClass(), NOOP_ACTION).handle(event); ACTIONS.getOrDefault(event.getCheckClass(), NOOP_ACTION).handle(event);
if (event.shouldTellStaff())
{
CheckThresholds thresholds = CHECKS.getOrDefault(event.getCheckClass(), NOOP_THRESHOLD); CheckThresholds thresholds = CHECKS.getOrDefault(event.getCheckClass(), NOOP_THRESHOLD);
CheckThresholds.Severity severity = thresholds.getSeverity(event.getViolations()); CheckThresholds.Severity severity = thresholds.getSeverity(event.getViolations());
@ -389,7 +390,6 @@ public class AntiHack extends MiniPlugin
this._cooldown.put(key, event.getViolations()); this._cooldown.put(key, event.getViolations());
} }
} }
}
/** /**
* Add a GWEN Anticheat class to the ignored checks. * Add a GWEN Anticheat class to the ignored checks.

View File

@ -1,14 +1,20 @@
package mineplex.core.antihack; package mineplex.core.antihack;
import net.minecraft.server.v1_8_R3.MinecraftServer; import net.minecraft.server.v1_8_R3.MinecraftServer;
import net.minecraft.server.v1_8_R3.MobEffect;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.potion.PotionEffectType;
import com.mineplex.anticheat.api.MineplexLink; import com.mineplex.anticheat.api.MineplexLink;
import mineplex.core.Managers; import mineplex.core.Managers;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseBase;
@ -17,6 +23,8 @@ public class MineplexLinkImpl implements MineplexLink
{ {
private final DisguiseManager _disguiseManager = Managers.require(DisguiseManager.class); private final DisguiseManager _disguiseManager = Managers.require(DisguiseManager.class);
private final RegisteredServiceProvider<RelationProvider> _relationProvider = Bukkit.getServicesManager().getRegistration(RelationProvider.class);
@Override @Override
public EntityType getActiveDisguise(Player player) public EntityType getActiveDisguise(Player player)
{ {
@ -47,4 +55,29 @@ public class MineplexLinkImpl implements MineplexLink
{ {
return ((CraftPlayer) player).getHandle().bS(); // See Anticheat javadoc return ((CraftPlayer) player).getHandle().bS(); // See Anticheat javadoc
} }
@Override
public int allocateNewEntityID()
{
return UtilEnt.getNewEntityId();
}
@Override
public boolean isUsingElytra(Player player)
{
return ((CraftPlayer) player).getHandle().isGliding();
}
@Override
public int getLevitationAmplifier(Player player)
{
MobEffect effect = ((CraftPlayer) player).getHandle().effects.get(PotionEffectType.LEVITATION.getId());
return effect == null ? -1 : effect.getAmplifier();
}
@Override
public boolean canDamage(Player attacker, Entity target)
{
return _relationProvider != null && _relationProvider.getProvider().canDamage(attacker, target);
}
} }

View File

@ -0,0 +1,9 @@
package mineplex.core.antihack;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
public interface RelationProvider
{
boolean canDamage(Player player, Entity target);
}

View File

@ -1,5 +1,7 @@
package mineplex.core.antihack.actions; package mineplex.core.antihack.actions;
import java.util.concurrent.TimeUnit;
import com.mineplex.anticheat.api.PlayerViolationEvent; import com.mineplex.anticheat.api.PlayerViolationEvent;
import mineplex.core.Managers; import mineplex.core.Managers;
@ -10,8 +12,8 @@ import mineplex.core.common.util.UtilServer;
public class BanwaveAction extends AntiHackAction public class BanwaveAction extends AntiHackAction
{ {
private static final int BAN_DELAY_AVERAGE = 6 * 60 * 60 * 1000; // 6 hours private static final int BAN_DELAY_MINIMUM_MINUTES = 30;
private static final int BAN_DELAY_VARIANCE_SPAN = 4 * 60 * 60 * 1000; // 4 hours total; 2 on either side private static final int BAN_DELAY_MAXIMUM_MINUTES = (int) TimeUnit.MINUTES.convert(2, TimeUnit.HOURS);
public BanwaveAction(int vl) public BanwaveAction(int vl)
{ {
@ -28,8 +30,9 @@ public class BanwaveAction extends AntiHackAction
} }
if (event.getViolations() >= this.getMinVl()) if (event.getViolations() >= this.getMinVl())
{ {
// Delay bans by 6 hours +/- 2 hours for fuzzing // Delay bans by 1.25 hours +/- .75 hours for fuzzing
long banTime = System.currentTimeMillis() + BAN_DELAY_AVERAGE + (UtilMath.r(BAN_DELAY_VARIANCE_SPAN) - (BAN_DELAY_VARIANCE_SPAN / 2)); long banDelayMinutes = UtilMath.r(BAN_DELAY_MAXIMUM_MINUTES - BAN_DELAY_MINIMUM_MINUTES) + BAN_DELAY_MINIMUM_MINUTES;
long banTime = System.currentTimeMillis() + TimeUnit.MILLISECONDS.convert(banDelayMinutes, TimeUnit.MINUTES);
Managers.get(BanWaveManager.class).insertBanWaveInfo( Managers.get(BanWaveManager.class).insertBanWaveInfo(
event.getPlayer(), event.getPlayer(),
banTime, banTime,

View File

@ -0,0 +1,43 @@
package mineplex.core.arcadeevents;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import mineplex.core.game.GameDisplay;
/**
* This event is called when a game starts in arcade
* It's called inside Arcade and handled inside Core,
* so we can track game events in core
*/
public class CoreGameStartEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private GameDisplay _gameDisplay;
/**
* @param gameDisplay the type of the game
*/
public CoreGameStartEvent(GameDisplay gameDisplay)
{
_gameDisplay = gameDisplay;
}
public GameDisplay getGameDisplay()
{
return _gameDisplay;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
}

View File

@ -0,0 +1,43 @@
package mineplex.core.arcadeevents;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import mineplex.core.game.GameDisplay;
/**
* This event is called when a game stops in arcade
* It's called inside Arcade and handled inside Core,
* so we can track game events in core
*/
public class CoreGameStopEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private GameDisplay _gameDisplay;
/**
* @param gameDisplay the type of the game
*/
public CoreGameStopEvent(GameDisplay gameDisplay)
{
_gameDisplay = gameDisplay;
}
public GameDisplay getGameDisplay()
{
return _gameDisplay;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
}

View File

@ -1,17 +1,19 @@
package mineplex.core.cosmetic.ui; package mineplex.core.cosmetic.ui;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.messaging.PluginMessageListener;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.page.GadgetPage; import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.cosmetic.ui.page.PetTagPage; import mineplex.core.cosmetic.ui.page.PetTagPage;
import mineplex.core.cosmetic.ui.page.custompet.name.CustomPetTagPage;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent; import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent;
import mineplex.core.shop.ShopBase; import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.messaging.PluginMessageListener;
public class CosmeticShop extends ShopBase<CosmeticManager> implements PluginMessageListener public class CosmeticShop extends ShopBase<CosmeticManager> implements PluginMessageListener
{ {
@ -43,6 +45,16 @@ public class CosmeticShop extends ShopBase<CosmeticManager> implements PluginMes
((PetTagPage) getPlayerPageMap().get(player.getUniqueId())).SetTagName(tagName); ((PetTagPage) getPlayerPageMap().get(player.getUniqueId())).SetTagName(tagName);
} }
} }
if (getPlayerPageMap().containsKey(player.getUniqueId()) && getPlayerPageMap().get(player.getUniqueId()) instanceof CustomPetTagPage)
{
if (message != null && message.length >= 1)
{
String tagName = new String(message);
((CustomPetTagPage) getPlayerPageMap().get(player.getUniqueId())).setTagName(tagName);
}
}
} }
@EventHandler @EventHandler

View File

@ -180,6 +180,11 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in St Patrick's Chests"); itemLore.add(C.cBlue + "Found in St Patrick's Chests");
} }
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -19)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Spring Chests");
}
//Rank Unlocks //Rank Unlocks
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -10) else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -10)

View File

@ -6,7 +6,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Creature; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
@ -142,7 +142,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
petMax++; petMax++;
} }
Creature petActive = getPlugin().getPetManager().getPet(getPlayer()); Entity petActive = getPlugin().getPetManager().getPet(getPlayer());
GadgetType type = GadgetType.PARTICLE; GadgetType type = GadgetType.PARTICLE;
String[] lore = getLore(ownedCount.get(type), maxCount.get(type), "Show everyone how cool you are with swirly particles that follow you when you walk!", VISIBILITY_EVERYWHERE, enabled.get(type)); String[] lore = getLore(ownedCount.get(type), maxCount.get(type), "Show everyone how cool you are with swirly particles that follow you when you walk!", VISIBILITY_EVERYWHERE, enabled.get(type));

View File

@ -21,7 +21,6 @@ import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
@ -40,7 +39,6 @@ import mineplex.core.cosmetic.ui.button.deactivate.DeactivatePetButton;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.pet.PetExtra; import mineplex.core.pet.PetExtra;
import mineplex.core.pet.PetType; import mineplex.core.pet.PetType;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.AnvilContainer; import mineplex.core.shop.page.AnvilContainer;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
@ -63,7 +61,7 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
for (PetType pet : pets) for (PetType pet : pets)
{ {
List<String> itemLore = new ArrayList<String>(); List<String> itemLore = new ArrayList<>();
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
if (pet.getLore().isPresent()) if (pet.getLore().isPresent())
@ -118,6 +116,11 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in St Patrick's Chests"); itemLore.add(C.cBlue + "Found in St Patrick's Chests");
} }
else if (pet.getPrice() == -19)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Spring Chests");
}
else if (pet.getPrice() == -14) else if (pet.getPrice() == -14)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
@ -255,13 +258,13 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
slot++; slot++;
} }
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() // Custom pet
{ /*addButton(50, new ShopItem(Material.GLASS, C.cGreen + "Custom", new String[]{}, 1, false), (player, clickType) ->
public void onClick(Player player, ClickType clickType) getShop().openPageForPlayer(getPlayer(), new CustomPetBasePage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Custom Pet", player)));*/
{
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
} addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) ->
}); getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)));
} }
public void purchasePet(final Player player, final PetType petType) public void purchasePet(final Player player, final PetType petType)

View File

@ -0,0 +1,25 @@
package mineplex.core.cosmetic.ui.page.custompet;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.shop.item.IButton;
public class ActivateCustomPetButton implements IButton
{
private GadgetPage _page;
public ActivateCustomPetButton(GadgetPage page)
{
_page = page;
}
@Override
public void onClick(Player player, ClickType clickType)
{
/*_page.playAcceptSound(player);
_page.getPlugin().getPetManager().addPetOwner(player, PetType.CUSTOM, player.getLocation());
_page.getShop().openPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player));*/
}
}

View File

@ -0,0 +1,62 @@
package mineplex.core.cosmetic.ui.page.custompet;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.donation.DonationManager;
import mineplex.core.pet.custom.CustomPet;
import mineplex.core.shop.item.ShopItem;
public class CustomPetBasePage extends GadgetPage
{
public CustomPetBasePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
{
super(plugin, shop, clientManager, donationManager, name, player);
}
@Override
protected void buildPage()
{
// TODO
// EDIT PET
// DISABLE PET
// RENAME PET
// RESET PET
int slot = 10;
for (CustomPet.CustomPetType customPetType : CustomPet.CustomPetType.values())
{
addButton(slot, new ShopItem(customPetType.getMaterial(), customPetType.getData(), customPetType.getName(), new String[]{}, 1, false, false), (player, clickType) ->
{
CustomPet customPet = CustomPet.getCustomPet(player);
if (customPet == null)
{
customPet = customPetType.getCustomPet(getPlugin().getPetManager(), player);
}
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
slot++;
if (slot == 17)
slot += 2;
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) ->
{
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
CustomPet.removeCustomPet(player);
});
}
}

View File

@ -0,0 +1,59 @@
package mineplex.core.cosmetic.ui.page.custompet;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.donation.DonationManager;
import mineplex.core.pet.custom.CustomPet;
import mineplex.core.shop.item.ShopItem;
public class CustomPetConfirmPage extends GadgetPage
{
public CustomPetConfirmPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
{
super(plugin, shop, clientManager, donationManager, name, player);
}
@Override
protected void buildPage()
{
CustomPet customPet = CustomPet.getCustomPet(getPlayer());
if (customPet == null)
{
CustomPet.removeCustomPet(getPlayer());
getPlayer().closeInventory();
return;
}
int[] confirm = {19, 20, 21, 28, 29, 30, 37, 38, 39};
int[] cancel = {23, 24, 25, 32, 33, 34, 41, 42, 43};
ShopItem confirmItem = new ShopItem(Material.WOOL, (byte) 5, "Confirm", new String[]{}, 1, false, false);
ShopItem cancelItem = new ShopItem(Material.WOOL, (byte) 14, "Cancel", new String[]{}, 1, false, false);
for (int aConfirm : confirm)
{
addButton(aConfirm, confirmItem, new ActivateCustomPetButton(this));
}
for (int aCancel : cancel)
{
addButton(aCancel, cancelItem, (player, clickType) ->
{
player.closeInventory();
CustomPet.removeCustomPet(player);
});
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) ->
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())));
}
}

View File

@ -0,0 +1,61 @@
package mineplex.core.cosmetic.ui.page.custompet.age;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.donation.DonationManager;
import mineplex.core.pet.custom.CustomPet;
import mineplex.core.pet.custom.CustomPetAgeable;
import mineplex.core.shop.item.ShopItem;
public class CustomPetAgePage extends GadgetPage
{
public CustomPetAgePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
{
super(plugin, shop, clientManager, donationManager, name, player);
}
@Override
protected void buildPage()
{
CustomPet customPet = CustomPet.getCustomPet(getPlayer());
if (customPet == null)
{
CustomPet.removeCustomPet(getPlayer());
getPlayer().closeInventory();
return;
}
if (!(customPet instanceof CustomPetAgeable))
{
CustomPet.removeCustomPet(getPlayer());
getPlayer().closeInventory();
return;
}
CustomPetAgeable customPetAgeable = (CustomPetAgeable) customPet;
addButton(29, new ShopItem(Material.SEEDS, "Baby", 1, false), (player, clickType) ->
{
customPetAgeable.setBaby(true);
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(33, new ShopItem(Material.WHEAT, "Adult", 1, false), (player, clickType) ->
{
customPetAgeable.setBaby(false);
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) ->
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())));
}
}

View File

@ -0,0 +1,89 @@
package mineplex.core.cosmetic.ui.page.custompet.equipment;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.donation.DonationManager;
import mineplex.core.pet.custom.CustomPet;
import mineplex.core.pet.custom.CustomPetEquipment;
import mineplex.core.shop.item.ShopItem;
public class CustomPetBootsPage extends GadgetPage
{
public CustomPetBootsPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
{
super(plugin, shop, clientManager, donationManager, name, player);
}
@Override
protected void buildPage()
{
CustomPet customPet = CustomPet.getCustomPet(getPlayer());
if (customPet == null)
{
CustomPet.removeCustomPet(getPlayer());
getPlayer().closeInventory();
return;
}
if (!(customPet instanceof CustomPetEquipment))
{
CustomPet.removeCustomPet(getPlayer());
getPlayer().closeInventory();
return;
}
CustomPetEquipment customPetEquipment = (CustomPetEquipment) customPet;
// Leather helmet
addButton(19, new ShopItem(Material.LEATHER_BOOTS, "Leather", 1, false), (player, clickType) ->
{
// TODO COLORED ARMOR
customPetEquipment.setBoots(new ItemStack(Material.LEATHER_BOOTS));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(22, new ShopItem(Material.CHAINMAIL_BOOTS, "Chain", 1, false), (player, clickType) ->
{
customPetEquipment.setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(25, new ShopItem(Material.IRON_BOOTS, "Iron", 1, false), (player, clickType) ->
{
customPetEquipment.setBoots(new ItemStack(Material.IRON_HELMET));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(38, new ShopItem(Material.GOLD_BOOTS, "Gold", 1, false), (player, clickType) ->
{
customPetEquipment.setBoots(new ItemStack(Material.GOLD_BOOTS));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(40, new ShopItem(Material.BARRIER, "None", 1, false), (player, clickType) ->
{
customPetEquipment.setBoots(new ItemStack(Material.AIR));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(42, new ShopItem(Material.DIAMOND_BOOTS, "Diamond", 1, false), (player, clickType) ->
{
customPetEquipment.setBoots(new ItemStack(Material.DIAMOND_BOOTS));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) ->
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())));
}
}

View File

@ -0,0 +1,88 @@
package mineplex.core.cosmetic.ui.page.custompet.equipment;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.donation.DonationManager;
import mineplex.core.pet.custom.CustomPet;
import mineplex.core.pet.custom.CustomPetEquipment;
import mineplex.core.shop.item.ShopItem;
public class CustomPetChestplatePage extends GadgetPage
{
public CustomPetChestplatePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
{
super(plugin, shop, clientManager, donationManager, name, player);
}
@Override
protected void buildPage()
{
CustomPet customPet = CustomPet.getCustomPet(getPlayer());
if (customPet == null)
{
CustomPet.removeCustomPet(getPlayer());
getPlayer().closeInventory();
return;
}
if (!(customPet instanceof CustomPetEquipment))
{
CustomPet.removeCustomPet(getPlayer());
getPlayer().closeInventory();
return;
}
CustomPetEquipment customPetEquipment = (CustomPetEquipment) customPet;
// Leather helmet
addButton(19, new ShopItem(Material.LEATHER_CHESTPLATE, "Leather", 1, false), (player, clickType) ->
{
// TODO COLORED ARMOR
customPetEquipment.setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(22, new ShopItem(Material.CHAINMAIL_CHESTPLATE, "Chain", 1, false), (player, clickType) ->
{
customPetEquipment.setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(25, new ShopItem(Material.IRON_CHESTPLATE, "Iron", 1, false), (player, clickType) ->
{
customPetEquipment.setChestplate(new ItemStack(Material.IRON_HELMET));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(38, new ShopItem(Material.GOLD_CHESTPLATE, "Gold", 1, false), (player, clickType) ->
{
customPetEquipment.setChestplate(new ItemStack(Material.GOLD_CHESTPLATE));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(40, new ShopItem(Material.BARRIER, "None", 1, false), (player, clickType) ->
{
customPetEquipment.setChestplate(new ItemStack(Material.AIR));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(42, new ShopItem(Material.DIAMOND_CHESTPLATE, "Diamond", 1, false), (player, clickType) ->
{
customPetEquipment.setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) ->
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())));
}
}

View File

@ -0,0 +1,88 @@
package mineplex.core.cosmetic.ui.page.custompet.equipment;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.donation.DonationManager;
import mineplex.core.pet.custom.CustomPet;
import mineplex.core.pet.custom.CustomPetEquipment;
import mineplex.core.shop.item.ShopItem;
public class CustomPetHelmetPage extends GadgetPage
{
public CustomPetHelmetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
{
super(plugin, shop, clientManager, donationManager, name, player);
}
@Override
protected void buildPage()
{
CustomPet customPet = CustomPet.getCustomPet(getPlayer());
if (customPet == null)
{
CustomPet.removeCustomPet(getPlayer());
getPlayer().closeInventory();
return;
}
if (!(customPet instanceof CustomPetEquipment))
{
CustomPet.removeCustomPet(getPlayer());
getPlayer().closeInventory();
return;
}
CustomPetEquipment customPetEquipment = (CustomPetEquipment) customPet;
// Leather helmet
addButton(19, new ShopItem(Material.LEATHER_HELMET, "Leather", 1, false), (player, clickType) ->
{
// TODO COLORED ARMOR
customPetEquipment.setHelmet(new ItemStack(Material.LEATHER_HELMET));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(22, new ShopItem(Material.CHAINMAIL_HELMET, "Chain", 1, false), (player, clickType) ->
{
customPetEquipment.setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(25, new ShopItem(Material.IRON_HELMET, "Iron", 1, false), (player, clickType) ->
{
customPetEquipment.setHelmet(new ItemStack(Material.IRON_HELMET));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(38, new ShopItem(Material.GOLD_HELMET, "Gold", 1, false), (player, clickType) ->
{
customPetEquipment.setHelmet(new ItemStack(Material.GOLD_HELMET));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(40, new ShopItem(Material.BARRIER, "None", 1, false), (player, clickType) ->
{
customPetEquipment.setHelmet(new ItemStack(Material.AIR));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(42, new ShopItem(Material.DIAMOND_HELMET, "Diamond", 1, false), (player, clickType) ->
{
customPetEquipment.setHelmet(new ItemStack(Material.DIAMOND_HELMET));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) ->
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())));
}
}

View File

@ -0,0 +1,88 @@
package mineplex.core.cosmetic.ui.page.custompet.equipment;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.donation.DonationManager;
import mineplex.core.pet.custom.CustomPet;
import mineplex.core.pet.custom.CustomPetEquipment;
import mineplex.core.shop.item.ShopItem;
public class CustomPetLeggingsPage extends GadgetPage
{
public CustomPetLeggingsPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
{
super(plugin, shop, clientManager, donationManager, name, player);
}
@Override
protected void buildPage()
{
CustomPet customPet = CustomPet.getCustomPet(getPlayer());
if (customPet == null)
{
CustomPet.removeCustomPet(getPlayer());
getPlayer().closeInventory();
return;
}
if (!(customPet instanceof CustomPetEquipment))
{
CustomPet.removeCustomPet(getPlayer());
getPlayer().closeInventory();
return;
}
CustomPetEquipment customPetEquipment = (CustomPetEquipment) customPet;
// Leather helmet
addButton(19, new ShopItem(Material.LEATHER_LEGGINGS, "Leather", 1, false), (player, clickType) ->
{
// TODO COLORED ARMOR
customPetEquipment.setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(22, new ShopItem(Material.CHAINMAIL_LEGGINGS, "Chain", 1, false), (player, clickType) ->
{
customPetEquipment.setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(25, new ShopItem(Material.IRON_LEGGINGS, "Iron", 1, false), (player, clickType) ->
{
customPetEquipment.setLeggings(new ItemStack(Material.IRON_HELMET));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(38, new ShopItem(Material.GOLD_LEGGINGS, "Gold", 1, false), (player, clickType) ->
{
customPetEquipment.setLeggings(new ItemStack(Material.GOLD_LEGGINGS));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(40, new ShopItem(Material.BARRIER, "None", 1, false), (player, clickType) ->
{
customPetEquipment.setLeggings(new ItemStack(Material.AIR));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(42, new ShopItem(Material.DIAMOND_LEGGINGS, "Diamond", 1, false), (player, clickType) ->
{
customPetEquipment.setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) ->
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())));
}
}

View File

@ -0,0 +1,16 @@
package mineplex.core.cosmetic.ui.page.custompet.name;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.pet.custom.CustomPet;
import mineplex.core.shop.item.IButton;
public class CloseCustomPetButton implements IButton
{
public void onClick(Player player, ClickType clickType)
{
player.closeInventory();
CustomPet.removeCustomPet(player);
}
}

View File

@ -0,0 +1,63 @@
package mineplex.core.cosmetic.ui.page.custompet.name;
import net.minecraft.server.v1_8_R3.Blocks;
import net.minecraft.server.v1_8_R3.ChatMessage;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import net.minecraft.server.v1_8_R3.Items;
import net.minecraft.server.v1_8_R3.PacketPlayOutOpenWindow;
import net.minecraft.server.v1_8_R3.PacketPlayOutSetSlot;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.donation.DonationManager;
import mineplex.core.pet.custom.CustomPet;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.AnvilContainer;
public class CustomPetNamePage extends GadgetPage
{
public CustomPetNamePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
{
super(plugin, shop, clientManager, donationManager, name, player);
}
@Override
protected void buildPage()
{
CustomPet customPet = CustomPet.getCustomPet(getPlayer());
if (customPet == null)
{
CustomPet.removeCustomPet(getPlayer());
getPlayer().closeInventory();
return;
}
addButton(31, new ShopItem(Material.NAME_TAG, "Name", 1, false), (player, clickType) ->
{
CustomPetTagPage customPetTagPage = new CustomPetTagPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Pet Name", getPlayer());
EntityPlayer entityPlayer = ((CraftPlayer) getPlayer()).getHandle();
int containerCounter = entityPlayer.nextContainerCounter();
UtilPlayer.sendPacket(player, new PacketPlayOutOpenWindow(containerCounter, "minecraft:anvil", new ChatMessage(Blocks.ANVIL.a() + ".name", new Object[0])));
entityPlayer.activeContainer = new AnvilContainer(entityPlayer.inventory, customPetTagPage.getInventory());
entityPlayer.activeContainer.windowId = containerCounter;
entityPlayer.activeContainer.addSlotListener(entityPlayer);
UtilPlayer.sendPacket(player, new PacketPlayOutSetSlot(containerCounter, 0, new net.minecraft.server.v1_8_R3.ItemStack(Items.NAME_TAG)));
getShop().setCurrentPageForPlayer(getPlayer(), customPetTagPage);
});
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) ->
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())));
}
}

View File

@ -0,0 +1,95 @@
package mineplex.core.cosmetic.ui.page.custompet.name;
import net.minecraft.server.v1_8_R3.ItemStack;
import net.minecraft.server.v1_8_R3.Items;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager;
import mineplex.core.pet.custom.CustomPet;
import mineplex.core.shop.page.ShopPageBase;
public class CustomPetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
private String _tagName = "Pet Name";
public CustomPetTagPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
{
super(plugin, shop, clientManager, donationManager, name, player, 3);
buildPage();
}
@Override
protected void buildPage()
{
inventory.setItem(0, new ItemStack(Items.NAME_TAG));
getButtonMap().put(0, new CloseCustomPetButton());
getButtonMap().put(1, new CloseCustomPetButton());
getButtonMap().put(2, new SelectCustomPetTagButton(this));
}
@Override
public void playerClosed()
{
super.playerClosed();
}
public void selectTag()
{
CustomPet customPet = CustomPet.getCustomPet(_player);
if (customPet == null)
{
_player.closeInventory();
CustomPet.removeCustomPet(_player);
return;
}
_tagName = ChatColor.stripColor(_tagName);
_tagName = _tagName.replaceAll("[^A-Za-z0-9]", "");
System.out.println("Pet name: " + _tagName + ".");
if (_tagName.length() == 0)
{
UtilPlayer.message(getPlayer(), F.main(getPlugin().getName(), ChatColor.RED + "Supplied pet name contains invalid characters."));
playDenySound(getPlayer());
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
return;
}
if (_tagName.length() > 16)
{
UtilPlayer.message(getPlayer(), F.main(getPlugin().getName(), ChatColor.RED + "Pet name cannot be longer than 16 characters."));
playDenySound(getPlayer());
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
return;
}
if (_tagName.toLowerCase().contains("ultra"))
{
UtilPlayer.message(getPlayer(), F.main(getPlugin().getName(), ChatColor.RED + _tagName + " is a restricted name."));
playDenySound(getPlayer());
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
return;
}
customPet.setName(_tagName);
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
}
public void setTagName(String tagName)
{
_tagName = tagName;
}
}

View File

@ -0,0 +1,21 @@
package mineplex.core.cosmetic.ui.page.custompet.name;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.IButton;
public class SelectCustomPetTagButton implements IButton
{
private CustomPetTagPage _page;
public SelectCustomPetTagButton(CustomPetTagPage page)
{
_page = page;
}
public void onClick(Player player, ClickType clickType)
{
_page.selectTag();
}
}

View File

@ -0,0 +1,61 @@
package mineplex.core.cosmetic.ui.page.custompet.zombie;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.donation.DonationManager;
import mineplex.core.pet.custom.CustomPet;
import mineplex.core.pet.custom.CustomPetZombie;
import mineplex.core.shop.item.ShopItem;
public class CustomPetZombieTypePage extends GadgetPage
{
public CustomPetZombieTypePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
{
super(plugin, shop, clientManager, donationManager, name, player);
}
@Override
protected void buildPage()
{
CustomPet customPet = CustomPet.getCustomPet(getPlayer());
if (customPet == null)
{
CustomPet.removeCustomPet(getPlayer());
getPlayer().closeInventory();
return;
}
if (!(customPet instanceof CustomPetZombie))
{
CustomPet.removeCustomPet(getPlayer());
getPlayer().closeInventory();
return;
}
CustomPetZombie customPetZombie = (CustomPetZombie) customPet;
addButton(29, new ShopItem(Material.BARRIER, "Zombie", 1, false), (player, clickType) ->
{
customPetZombie.setVillager(false);
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(33, new ShopItem(Material.WHEAT, "Zombie Villager", 1, false), (player, clickType) ->
{
customPetZombie.setVillager(true);
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
});
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) ->
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())));
}
}

View File

@ -1,5 +1,7 @@
package mineplex.core.disguise.playerdisguise; package mineplex.core.disguise.playerdisguise;
import java.util.UUID;
import mineplex.core.command.CommandBase; import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
@ -17,11 +19,14 @@ public class DisguiseCommand extends CommandBase<PlayerDisguiseManager> implemen
@Override @Override
public void Execute(final Player caller, final String[] args) public void Execute(final Player caller, final String[] args)
{ {
String realName = Plugin.getRealName(caller);
String currentName = caller.getName();
UUID currentUUID = caller.getUniqueId();
if (args == null || args.length == 0) if (args == null || args.length == 0)
{ {
Plugin.runAsync(() -> Plugin.runAsync(() ->
{ {
new PlayerDisguiseNotification(Plugin.getRealName(caller), caller.getUniqueId(), caller.getName()).publish(); new PlayerDisguiseNotification(realName, currentUUID, currentName).publish();
}); });
Plugin.undisguise(caller); Plugin.undisguise(caller);
return; return;
@ -34,7 +39,7 @@ public class DisguiseCommand extends CommandBase<PlayerDisguiseManager> implemen
Plugin.runAsync(() -> Plugin.runAsync(() ->
{ {
new PlayerDisguiseNotification(Plugin.getRealName(caller), caller.getUniqueId(), args[0], args.length > 1 ? args[1] : args[0]).publish(); new PlayerDisguiseNotification(realName, currentUUID, args[0], args.length > 1 ? args[1] : args[0]).publish();
}); });
Plugin.disguise(caller, args[0], args.length > 1 ? args[1] : args[0]); Plugin.disguise(caller, args[0], args.length > 1 ? args[1] : args[0]);

View File

@ -1,7 +1,36 @@
package mineplex.core.disguise.playerdisguise; package mineplex.core.disguise.playerdisguise;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.function.Consumer;
import net.minecraft.server.v1_8_R3.MinecraftServer;
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn;
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo;
import net.minecraft.server.v1_8_R3.PlayerList;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import com.google.common.collect.ImmutableSet;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.Property;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.ReflectivelyCreateMiniPlugin; import mineplex.core.ReflectivelyCreateMiniPlugin;
import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClient;
@ -33,33 +62,60 @@ import mineplex.serverdata.Region;
import mineplex.serverdata.data.PlayerStatus; import mineplex.serverdata.data.PlayerStatus;
import mineplex.serverdata.redis.RedisDataRepository; import mineplex.serverdata.redis.RedisDataRepository;
import mineplex.serverdata.servers.ServerManager; import mineplex.serverdata.servers.ServerManager;
import net.minecraft.server.v1_8_R3.MinecraftServer;
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn;
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo;
import net.minecraft.server.v1_8_R3.PlayerList;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import java.lang.reflect.Field;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.function.Consumer;
@ReflectivelyCreateMiniPlugin @ReflectivelyCreateMiniPlugin
public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
{ {
private static final Set<String> MOJANG;
private static final Set<String> ILLEGAL_USERNAMES;
private static final Set<String> ILLEGAL_CAPES;
private static final Set<String> VERY_SPECIAL_PEOPLE;
static
{
MOJANG = ImmutableSet.copyOf(Arrays.asList("____fox____", "_tommo_", "aeplh", "amir343", "angryem", "ashrafi",
"binni", "blurpi", "bopogamel", "c418", "carlmanneh", "carnalizer", "darngeek", "dinnerbone", "eldrone",
"elevenen", "engst", "excitedze", "frukthamster", "geuder", "grumm", "hampus", "helloiammarsh", "hey",
"hoodad", "jeb_", "jonkagstrom", "kappe", "klumpig", "krisjelbring", "ladyagnes", "lisa", "mahuldur",
"mansolson", "marc", "marc_irl", "masseffect", "midnightenforcer", "minecraftchick", "modhelius",
"mojangjonas", "mojangsta", "mollstam", "neonmaster", "notch", "olle", "olofcarlson", "phreakholm",
"poipoichen", "pretto", "profmobius", "razzleberryfox", "searge", "searge_dp", "shoghicp", "slicedlime",
"sockerpappan", "themogminer", "vaktis", "vubui", "xlson", "xsson", "yoloswag4lyfe", "zeeraw")
);
ILLEGAL_USERNAMES = ImmutableSet.copyOf(Arrays.asList("hypixel", "chiss", "dctr", "blondebug", "dooskee",
"tomcallister", "jessiemarcia", "spu_", "sp614x", "deadmau5", "gwen", "mineplex", "samczsun", "sethbling",
"xisuma", "cubehamster", "natet_bird", "qwertyuiopthepie"
));
VERY_SPECIAL_PEOPLE = ImmutableSet.copyOf(Arrays.asList(
"5399b615-3440-4c66-939d-ab1375952ac3", // Drullkus (Prismarine Cape)
"7f0eda55-7034-4dc8-886d-d94321cdedcf", // MrMessiah (Personal Cape)
"d90b68bc-8172-4329-a047-f1186dcd4336", // akronman1 (Millionth Customer)
"144ad5f0-e879-4141-a489-8ed5d496cab9", // JulianClark (Personal Cape)
"1c063715-395b-4db9-bc2a-d5dfd20366f7", // dannyBstyle (Personal Cape)
"5797c479-ad5a-43b0-87ca-8852d65ac639" // cheapsh0t (Personal Cape)
));
ILLEGAL_CAPES = ImmutableSet.copyOf(Arrays.asList(
"http://textures.minecraft.net/texture/eec3cabfaeed5dafe61c6546297e853a547c39ec238d7c44bf4eb4a49dc1f2c0", // Mojang
"http://textures.minecraft.net/texture/43a51d34b076f9ada555dca562206bd942e46a3c4d5f83c2c29e5b9c3d7dbcb", // Realms
"http://textures.minecraft.net/texture/2ffda25cf1a4ed8996b767c8d16d450ba22fee7b5e416299f88a65ec5a", // Translator
"http://textures.minecraft.net/texture/f8b55ca322e64a381b6484dac2d8aa42c78c6129336ea3ef4596f1d31b27ef", // Mojira Mod
"http://textures.minecraft.net/texture/1672c9f13ece9c4f39a96fe22638ecd513fbe7099ca4354d3176d3793d8e9c7", // Cobalt
"http://textures.minecraft.net/texture/86e841dcb6465d1f95a56270243d23c596da4721acd9ca2d95927b1b8535dc54", // Scrolls
"http://textures.minecraft.net/texture/c9c058adf4a2526aa5493cf6fe37f5dbdfde7b3d4fe4df982b7bee8329e64bd", // Translator (Chinese)
"http://textures.minecraft.net/texture/eec3cabfaeed5dafe61c6546297e853a547c39ec238d7c44bf4eb4a49dc1f2c0", // Mojang (Old)
"http://textures.minecraft.net/texture/2897938eb320cfd8eed6fd75d42db7a9f8e2e4a3c8da1c91f6f8e1ff18c5f4", // cheapsh0t
"http://textures.minecraft.net/texture/1658fd5989db3caffdeae2a5a70b2d0a531a7fae7401e7caef7645bccf3c", // dannyBstyle
"http://textures.minecraft.net/texture/3d991748ae6e1cfe10f34d532748b1911b1e82b5a110ae89c34f9a2295902e", // JulianClark
"http://textures.minecraft.net/texture/ec80a225b145c812a6ef1ca29af0f3ebf02163874d1a66e53bac99965225e0", // Millionth Customer
"http://textures.minecraft.net/texture/b8ff4a34df87fc7d8bf1bb77bd88ac34d16c3ff52985c128e71dbc3ccd19a028" // MrMessiah
// "//textures.minecraft.net/texture/?", // Drullkus??
));
}
public static final String ORIGINAL_UUID_KEY = "originalUUID"; public static final String ORIGINAL_UUID_KEY = "originalUUID";
private CoreClientManager _clients = require(CoreClientManager.class); private CoreClientManager _clients = require(CoreClientManager.class);
@ -161,7 +217,7 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
{ {
CoreClient client = _clients.Get(event.getPlayer()); CoreClient client = _clients.Get(event.getPlayer());
if (!client.GetRank().has(event.getPlayer(), Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.TWITCH}, false)) if (!client.GetRank().has(event.getPlayer(), Rank.ADMIN, new Rank[]{Rank.YOUTUBE, Rank.YOUTUBE_SMALL, Rank.TWITCH}, false))
return; return;
if (_redis.elementExists(client.getAccountId() + client.getName())) if (_redis.elementExists(client.getAccountId() + client.getName()))
@ -578,13 +634,23 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
public void disguise(Player caller, String requestedUsername, String requestedSkin) public void disguise(Player caller, String requestedUsername, String requestedSkin)
{ {
if (!validateUsername(caller, requestedUsername)) return; if (!validateUsername(caller, requestedUsername, true)) return;
if (!validateUsername(caller, requestedSkin)) return; if (!validateUsername(caller, requestedSkin, false)) return;
UtilGameProfile.getProfileByName(requestedUsername, true, requestedProfile -> UtilGameProfile.getProfileByName(requestedUsername, true, requestedProfile ->
{ {
if (VERY_SPECIAL_PEOPLE.contains(requestedProfile.getId().toString().toLowerCase()))
{
UtilPlayer.message(caller, F.main("Disguise", "The chosen username of " + F.elem(requestedUsername) + " is not valid"));
return;
}
if (!verifyProfile(caller, requestedProfile)) return;
Consumer<GameProfile> skinConsumer = requestedProfileSkin -> Consumer<GameProfile> skinConsumer = requestedProfileSkin ->
{ {
if (!verifyProfile(caller, requestedProfileSkin)) return;
SkinData skinData = SkinData.constructFromGameProfile(requestedProfileSkin, true, true); SkinData skinData = SkinData.constructFromGameProfile(requestedProfileSkin, true, true);
requestedProfile.getProperties().clear(); requestedProfile.getProperties().clear();
requestedProfile.getProperties().put("textures", skinData.getProperty()); requestedProfile.getProperties().put("textures", skinData.getProperty());
@ -603,27 +669,66 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
}); });
} }
private boolean validateUsername(Player caller, String username) private boolean validateUsername(Player caller, String username, boolean isUsername)
{ {
String replaced = UtilGameProfile.legalize(username); String replaced = UtilGameProfile.legalize(username);
if (!replaced.equals(username)) if (!replaced.equals(username))
{ {
UtilPlayer.message(caller, F.main(getName(), "The chosen username of '" + username + "' is not valid")); UtilPlayer.message(caller, F.main("Disguise", "The chosen username of " + F.elem(username) + " is not valid"));
return false; return false;
} }
if (username.length() > 16) if (username.length() > 16)
{ {
UtilPlayer.message(caller, F.main("Disguise", "The chosen username of '" + username + "' is " + F.count(String.valueOf(username.length() - 16)) + " characters too long!")); UtilPlayer.message(caller, F.main("Disguise", "The chosen username of " + F.elem(username) + " is " + F.count(String.valueOf(username.length() - 16)) + " characters too long!"));
return false; return false;
} }
if (username.length() <= 0) if (username.length() <= 0)
{ {
UtilPlayer.message(caller, F.main("Disguise", "The chosen username of '" + username + "' must be longer than 0 characters")); UtilPlayer.message(caller, F.main("Disguise", "The chosen username of " + F.elem(username) + " must be longer than " + F.count("0") + " characters"));
return false; return false;
} }
if (isUsername)
{
if (ILLEGAL_USERNAMES.contains(username.toLowerCase()) || MOJANG.contains(username.toLowerCase()))
{
if (!UtilServer.isTestServer())
{
UtilPlayer.message(caller, F.main("Disguise", "The chosen username of " + F.elem(username) + " is not valid"));
return false;
}
}
if (username.length() < 3)
{
if (!_clients.Get(caller).GetRank().has(Rank.ADMIN))
{
UtilPlayer.message(caller, F.main("Disguise", "The chosen username of " + F.elem(username) + " must be longer than " + F.count("2") + " letters"));
return false;
}
}
}
return true;
}
private boolean verifyProfile(Player caller, GameProfile requestedProfile)
{
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = MinecraftServer.getServer().aD().getTextures(requestedProfile, false);
if (map.containsKey(MinecraftProfileTexture.Type.CAPE))
{
MinecraftProfileTexture texture = map.get(MinecraftProfileTexture.Type.CAPE);
if (ILLEGAL_CAPES.contains(texture.getUrl().toLowerCase()))
{
if (!UtilServer.isTestServer())
{
UtilPlayer.message(caller, F.main("Disguise", "The chosen username of " + F.elem(requestedProfile.getName()) + " is not valid"));
return false;
}
}
}
return true; return true;
} }
} }

View File

@ -45,7 +45,7 @@ import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.event.GadgetEnableEvent;
import mineplex.core.gadget.event.PlayerToggleSwimEvent; import mineplex.core.gadget.event.PlayerToggleSwimEvent;
import mineplex.core.gadget.event.TauntCommandEvent; import mineplex.core.gadget.event.TauntCommandEvent;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHalloween; import mineplex.core.gadget.gadgets.arrowtrail.halloween.ArrowTrailHalloween;
import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane; import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane;
import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid; import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid;
import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald; import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald;
@ -55,6 +55,7 @@ import mineplex.core.gadget.gadgets.arrowtrail.howlingwinds.ArrowTrailStorm;
import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic; import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic;
import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti; import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti;
import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow; import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow;
import mineplex.core.gadget.gadgets.arrowtrail.spring.ArrowTrailSpring;
import mineplex.core.gadget.gadgets.arrowtrail.titan.ArrowTrailTitan; import mineplex.core.gadget.gadgets.arrowtrail.titan.ArrowTrailTitan;
import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood; import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood;
import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant; import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant;
@ -70,10 +71,11 @@ import mineplex.core.gadget.gadgets.death.howlingwinds.DeathStorm;
import mineplex.core.gadget.gadgets.death.music.DeathMusic; import mineplex.core.gadget.gadgets.death.music.DeathMusic;
import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst; import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst;
import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; import mineplex.core.gadget.gadgets.death.shadow.DeathShadow;
import mineplex.core.gadget.gadgets.death.spring.DeathSpring;
import mineplex.core.gadget.gadgets.death.titan.DeathTitan; import mineplex.core.gadget.gadgets.death.titan.DeathTitan;
import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; import mineplex.core.gadget.gadgets.death.vampire.DeathBlood;
import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHalloween; import mineplex.core.gadget.gadgets.doublejump.halloween.DoubleJumpHalloween;
import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane; import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane;
import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings; import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings;
import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald; import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald;
@ -83,6 +85,7 @@ import mineplex.core.gadget.gadgets.doublejump.howlingwinds.DoubleJumpStorm;
import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic; import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic;
import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker; import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker;
import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow; import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow;
import mineplex.core.gadget.gadgets.doublejump.spring.DoubleJumpSpring;
import mineplex.core.gadget.gadgets.doublejump.titan.DoubleJumpTitan; import mineplex.core.gadget.gadgets.doublejump.titan.DoubleJumpTitan;
import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood; import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood;
import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant; import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant;
@ -113,6 +116,7 @@ import mineplex.core.gadget.gadgets.item.ItemPaintbrush;
import mineplex.core.gadget.gadgets.item.ItemPartyPopper; import mineplex.core.gadget.gadgets.item.ItemPartyPopper;
import mineplex.core.gadget.gadgets.item.ItemSnowball; import mineplex.core.gadget.gadgets.item.ItemSnowball;
import mineplex.core.gadget.gadgets.item.ItemTNT; import mineplex.core.gadget.gadgets.item.ItemTNT;
import mineplex.core.gadget.gadgets.morph.MorphAwkwardRabbit;
import mineplex.core.gadget.gadgets.morph.MorphBat; import mineplex.core.gadget.gadgets.morph.MorphBat;
import mineplex.core.gadget.gadgets.morph.MorphBlaze; import mineplex.core.gadget.gadgets.morph.MorphBlaze;
import mineplex.core.gadget.gadgets.morph.MorphBlock; import mineplex.core.gadget.gadgets.morph.MorphBlock;
@ -164,6 +168,7 @@ import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes;
import mineplex.core.gadget.gadgets.particle.ParticleFairy; import mineplex.core.gadget.gadgets.particle.ParticleFairy;
import mineplex.core.gadget.gadgets.particle.ParticleFireRings; import mineplex.core.gadget.gadgets.particle.ParticleFireRings;
import mineplex.core.gadget.gadgets.particle.ParticleLegend; import mineplex.core.gadget.gadgets.particle.ParticleLegend;
import mineplex.core.gadget.gadgets.particle.spring.ParticleSpringHalo;
import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel; import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel;
import mineplex.core.gadget.gadgets.particle.ParticleWingsBee; import mineplex.core.gadget.gadgets.particle.ParticleWingsBee;
import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons; import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons;
@ -207,6 +212,7 @@ import mineplex.core.gadget.set.SetHowlingWinds;
import mineplex.core.gadget.set.SetMusic; import mineplex.core.gadget.set.SetMusic;
import mineplex.core.gadget.set.SetParty; import mineplex.core.gadget.set.SetParty;
import mineplex.core.gadget.set.SetShadow; import mineplex.core.gadget.set.SetShadow;
import mineplex.core.gadget.set.SetSpring;
import mineplex.core.gadget.set.SetTitan; import mineplex.core.gadget.set.SetTitan;
import mineplex.core.gadget.set.SetVampire; import mineplex.core.gadget.set.SetVampire;
import mineplex.core.gadget.set.SetWisdom; import mineplex.core.gadget.set.SetWisdom;
@ -238,6 +244,7 @@ import mineplex.core.mount.MountManager;
import mineplex.core.mount.event.MountActivateEvent; import mineplex.core.mount.event.MountActivateEvent;
import mineplex.core.packethandler.PacketHandler; import mineplex.core.packethandler.PacketHandler;
import mineplex.core.pet.PetManager; import mineplex.core.pet.PetManager;
import mineplex.core.pet.custom.CustomPet;
import mineplex.core.preferences.PreferencesManager; import mineplex.core.preferences.PreferencesManager;
import mineplex.core.projectile.ProjectileManager; import mineplex.core.projectile.ProjectileManager;
import mineplex.core.treasure.TreasureManager; import mineplex.core.treasure.TreasureManager;
@ -337,6 +344,7 @@ public class GadgetManager extends MiniPlugin
addSet(new SetVampire(this)); addSet(new SetVampire(this));
addSet(new SetMusic(this)); addSet(new SetMusic(this));
addSet(new SetFreedom(this)); addSet(new SetFreedom(this));
addSet(new SetSpring(this));
} }
private void createGadgets() private void createGadgets()
@ -425,6 +433,7 @@ public class GadgetManager extends MiniPlugin
addGadget(new MorphDinnerbone(this)); addGadget(new MorphDinnerbone(this));
addGadget(new MorphLoveDoctor(this)); addGadget(new MorphLoveDoctor(this));
addGadget(new MorphGoldPot(this)); addGadget(new MorphGoldPot(this));
addGadget(new MorphAwkwardRabbit(this));
// Particles // Particles
addGadget(new ParticleFoot(this)); addGadget(new ParticleFoot(this));
@ -450,6 +459,7 @@ public class GadgetManager extends MiniPlugin
addGadget(new ParticleFreedom(this)); addGadget(new ParticleFreedom(this));
addGadget(new ParticleChristmasTree(this)); addGadget(new ParticleChristmasTree(this));
addGadget(new ParticleWingsLove(this)); addGadget(new ParticleWingsLove(this));
addGadget(new ParticleSpringHalo(this));
addGadget(new ParticleWingsBee(this)); addGadget(new ParticleWingsBee(this));
// Arrow Trails // Arrow Trails
@ -466,6 +476,7 @@ public class GadgetManager extends MiniPlugin
addGadget(new ArrowTrailMusic(this)); addGadget(new ArrowTrailMusic(this));
addGadget(new ArrowTrailFreedom(this)); addGadget(new ArrowTrailFreedom(this));
addGadget(new ArrowTrailHalloween(this)); addGadget(new ArrowTrailHalloween(this));
addGadget(new ArrowTrailSpring(this));
// Death Effect // Death Effect
addGadget(new DeathFrostLord(this)); addGadget(new DeathFrostLord(this));
@ -481,6 +492,7 @@ public class GadgetManager extends MiniPlugin
addGadget(new DeathMusic(this)); addGadget(new DeathMusic(this));
addGadget(new DeathFreedom(this)); addGadget(new DeathFreedom(this));
addGadget(new DeathPresentDanger(this)); addGadget(new DeathPresentDanger(this));
addGadget(new DeathSpring(this));
// Double Jump // Double Jump
addGadget(new DoubleJumpFrostLord(this)); addGadget(new DoubleJumpFrostLord(this));
@ -496,6 +508,7 @@ public class GadgetManager extends MiniPlugin
addGadget(new DoubleJumpMusic(this)); addGadget(new DoubleJumpMusic(this));
addGadget(new DoubleJumpFreedom(this)); addGadget(new DoubleJumpFreedom(this));
addGadget(new DoubleJumpHalloween(this)); addGadget(new DoubleJumpHalloween(this));
addGadget(new DoubleJumpSpring(this));
// Hat // Hat
for (HatType hatType : HatType.values()) for (HatType hatType : HatType.values())
@ -1004,6 +1017,9 @@ public class GadgetManager extends MiniPlugin
event.getPlayer().setWalkSpeed(0.2f); event.getPlayer().setWalkSpeed(0.2f);
event.getPlayer().setFlySpeed(0.1f); event.getPlayer().setFlySpeed(0.1f);
_soulManager.giveSoul(event.getPlayer()); _soulManager.giveSoul(event.getPlayer());
// Removes custom pet
CustomPet.removeCustomPet(event.getPlayer());
} }
@EventHandler @EventHandler
@ -1369,7 +1385,7 @@ public class GadgetManager extends MiniPlugin
if (!event.isGameInProgress() && event.getState().equals(TauntCommandEvent.TauntState.NONE)) if (!event.isGameInProgress() && event.getState().equals(TauntCommandEvent.TauntState.NONE))
event.setState(TauntCommandEvent.TauntState.NOT_IN_GAME); event.setState(TauntCommandEvent.TauntState.NOT_IN_GAME);
if (taunt.isGameDisabled(event.getGameType()) && event.getState().equals(TauntCommandEvent.TauntState.NONE)) if (taunt.isGameDisabled(event.getGameDisplay()) && event.getState().equals(TauntCommandEvent.TauntState.NONE))
event.setState(TauntCommandEvent.TauntState.GAME_DISABLED); event.setState(TauntCommandEvent.TauntState.GAME_DISABLED);
if (!event.isAlive() && event.getState().equals(TauntCommandEvent.TauntState.NONE)) if (!event.isAlive() && event.getState().equals(TauntCommandEvent.TauntState.NONE))

View File

@ -5,7 +5,7 @@ import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.gadget.gadgets.taunts.GameType; import mineplex.core.game.GameDisplay;
public class TauntCommandEvent extends Event public class TauntCommandEvent extends Event
{ {
@ -18,16 +18,16 @@ public class TauntCommandEvent extends Event
private boolean _spectator; private boolean _spectator;
private long _lastPvp; private long _lastPvp;
private TauntState _state = TauntState.NONE; private TauntState _state = TauntState.NONE;
private GameType _gameType; private GameDisplay _gameDisplay;
public TauntCommandEvent(Player player, boolean gameInProgress, boolean alive, boolean spectator, long lastPvp, GameType gameType) public TauntCommandEvent(Player player, boolean gameInProgress, boolean alive, boolean spectator, long lastPvp, GameDisplay gameDisplay)
{ {
_player = player; _player = player;
_gameInProgress = gameInProgress; _gameInProgress = gameInProgress;
_alive = alive; _alive = alive;
_spectator = spectator; _spectator = spectator;
_lastPvp = lastPvp; _lastPvp = lastPvp;
_gameType = gameType; _gameDisplay = gameDisplay;
} }
public Player getPlayer() public Player getPlayer()
@ -60,9 +60,9 @@ public class TauntCommandEvent extends Event
return _state; return _state;
} }
public GameType getGameType() public GameDisplay getGameDisplay()
{ {
return _gameType; return _gameDisplay;
} }
public void setState(TauntState state) public void setState(TauntState state)

View File

@ -27,7 +27,6 @@ public class ArrowTrailCupid extends ArrowEffectGadget
@Override @Override
public void doTrail(Arrow arrow) public void doTrail(Arrow arrow)
{ {
arrow.setCritical(false);
Vector color = arrow.getTicksLived()%2 == 0? UtilColor.colorToVector(Color.RED) : UtilColor.colorToVector(Color.fromRGB(16738740)); Vector color = arrow.getTicksLived()%2 == 0? UtilColor.colorToVector(Color.RED) : UtilColor.colorToVector(Color.fromRGB(16738740));
UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, arrow.getLocation(), color, 1, 0, ViewDist.LONG); UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, arrow.getLocation(), color, 1, 0, ViewDist.LONG);
} }

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets.arrowtrail; package mineplex.core.gadget.gadgets.arrowtrail.halloween;
import java.awt.Color; import java.awt.Color;
import java.util.HashMap; import java.util.HashMap;

View File

@ -0,0 +1,73 @@
package mineplex.core.gadget.gadgets.arrowtrail.spring;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Item;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ArrowEffectGadget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ArrowTrailSpring extends ArrowEffectGadget
{
private List<Item> _items = new ArrayList<>();
public ArrowTrailSpring(GadgetManager manager)
{
super(manager, "Flower Arrows", UtilText.splitLineToArray(C.cGray + "Send the power of Spring flying at your foes!", LineFormat.LORE),
-19, Material.YELLOW_FLOWER, (byte) 0);
}
@Override
public void doTrail(Arrow arrow)
{
Item sunflower = arrow.getWorld().dropItem(arrow.getLocation(), new ItemStack(Material.DOUBLE_PLANT));
_items.add(sunflower);
}
@Override
public void doHitEffect(Arrow arrow)
{
}
@EventHandler
public void onPickup(PlayerPickupItemEvent event)
{
if (_items.contains(event.getItem()))
{
event.setCancelled(true);
}
}
@EventHandler
public void removeFlowers(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<Item> iterator = _items.iterator();
while (iterator.hasNext())
{
Item item = iterator.next();
if (item.getTicksLived() >= 20)
{
item.remove();
iterator.remove();
}
}
}
}

View File

@ -68,7 +68,10 @@ public class BalloonItem extends BalloonGadget
Entity entity = player.getWorld().spawnEntity(player.getLocation(), _balloonType.getEntityType()); Entity entity = player.getWorld().spawnEntity(player.getLocation(), _balloonType.getEntityType());
if (_balloonType.isBaby() && entity instanceof Ageable) if (_balloonType.isBaby() && entity instanceof Ageable)
{
((Ageable) entity).setBaby(); ((Ageable) entity).setBaby();
((Ageable) entity).setAgeLock(true);
}
UtilEnt.vegetate(entity); UtilEnt.vegetate(entity);
UtilEnt.silence(entity, true); UtilEnt.silence(entity, true);
addEntity(player, entity); addEntity(player, entity);

View File

@ -0,0 +1,103 @@
package mineplex.core.gadget.gadgets.death.spring;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.util.Vector;
import mineplex.core.blood.BloodEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.DeathEffectGadget;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class DeathSpring extends DeathEffectGadget
{
private List<Item> _items = new ArrayList<>();
public DeathSpring(GadgetManager manager)
{
super(manager, "Funeral Bouquet",
UtilText.splitLineToArray(C.cGray + "Leave a rose to pay respects", LineFormat.LORE),
-19,
Material.YELLOW_FLOWER, (byte) 0);
}
@Override
public void onBlood(Player player, BloodEvent event)
{
event.setCancelled(true);
final Location location = event.getLocation();
while (location.getBlock().getType() != Material.AIR
&& location.clone().add(0, 1, 0).getBlock().getType() != Material.AIR)
{
location.add(0, 1, 0);
}
location.getBlock().setType(Material.DOUBLE_PLANT);
location.getBlock().setData((byte) 4);
Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
{
@Override
public void run()
{
location.getBlock().setType(Material.AIR);
// Creates red rose explosion
for (int i = 50; i < 60; i++)
{
Item rose = location.getWorld().dropItem(location.add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.RED_ROSE, (byte) 0, 1, " " + i));
_items.add(rose);
Vector vel = new Vector(Math.sin(i * 9/5d), 0, Math.cos(i * 9/5d));
UtilAction.velocity(rose, vel, Math.abs(Math.sin(i * 12/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i * 12/3000d))*0.6, 1, false);
}
}
}, 60L);
}
@EventHandler
public void onPickup(PlayerPickupItemEvent event)
{
if (_items.contains(event.getItem()))
{
event.setCancelled(true);
}
}
@EventHandler
public void removeFlowers(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<Item> iterator = _items.iterator();
while (iterator.hasNext())
{
Item item = iterator.next();
if (item.getTicksLived() >= 20)
{
item.remove();
iterator.remove();
}
}
}
}

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets.doublejump; package mineplex.core.gadget.gadgets.doublejump.halloween;
import java.awt.Color; import java.awt.Color;
import java.util.HashMap; import java.util.HashMap;

View File

@ -0,0 +1,77 @@
package mineplex.core.gadget.gadgets.doublejump.spring;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.DoubleJumpEffectGadget;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class DoubleJumpSpring extends DoubleJumpEffectGadget
{
private List<Item> _items = new ArrayList<>();
public DoubleJumpSpring(GadgetManager manager)
{
// TODO NAME LORE ICON
super(manager, "Flower Power", UtilText.splitLineToArray(C.cGray + "Be like a bouncing bee and pollinate everywhere you go!", LineFormat.LORE), -19,
Material.YELLOW_FLOWER, (byte) 0);
}
@Override
public void doEffect(Player player)
{
for (int i = 50; i < 60; i++)
{
Item sunflower = player.getWorld().dropItem(player.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.DOUBLE_PLANT, (byte) 0, 1, " " + i));
_items.add(sunflower);
Vector vel = new Vector(Math.sin(i * 9/5d), 0, Math.cos(i * 9/5d));
UtilAction.velocity(sunflower, vel, Math.abs(Math.sin(i * 12/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i * 12/3000d))*0.6, 1, false);
}
}
@EventHandler
public void onPickup(PlayerPickupItemEvent event)
{
if (_items.contains(event.getItem()))
{
event.setCancelled(true);
}
}
@EventHandler
public void removeFlowers(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<Item> iterator = _items.iterator();
while (iterator.hasNext())
{
Item item = iterator.next();
if (item.getTicksLived() >= 20)
{
item.remove();
iterator.remove();
}
}
}
}

View File

@ -0,0 +1,105 @@
package mineplex.core.gadget.gadgets.morph;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerToggleSneakEvent;
import com.mojang.authlib.GameProfile;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilText;
import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.hologram.Hologram;
import mineplex.core.recharge.Recharge;
import mineplex.core.utils.UtilGameProfile;
public class MorphAwkwardRabbit extends MorphGadget
{
private List<String> _quotes = new ArrayList<>();
private static final long COOLDOWN = 10000;
private static final long HOLOGRAM_TIME = 3000;
public MorphAwkwardRabbit(GadgetManager manager)
{
super(manager, "Wascally Wabbit Morph",
UtilText.splitLinesToArray(new String[]{C.cGray + "Be absolutely silent my friends we are searching for rabbits currently!"}, LineFormat.LORE),
-19, Material.SKULL_ITEM, (byte) 0);
_quotes.addAll(Arrays.asList(
"Eh, what's up, doc?",
"That's all, folks.",
"Gee, ain't I a stinker?",
"Carrots are devine...",
"I know this defies the\n law of gravity,\n but I never studied law!",
"I dont ask questions,\n I just have fun",
"Hey, just a minute you!\n Thems fightin words!"));
setDisplayItem(SkinData.BUGS_BUNNY.getSkull());
}
@Override
public void enableCustom(Player player, boolean message)
{
applyArmor(player, message);
GameProfile gameProfile = UtilGameProfile.getGameProfile(player);
gameProfile.getProperties().clear();
gameProfile.getProperties().put("textures", SkinData.BUGS_BUNNY.getProperty());
DisguisePlayer disguisePlayer = new DisguisePlayer(player, gameProfile);
disguisePlayer.showInTabList(true, 0);
UtilMorph.disguise(player, disguisePlayer, Manager);
}
@Override
public void disableCustom(Player player, boolean message)
{
removeArmor(player);
UtilMorph.undisguise(player, Manager.getDisguiseManager());
}
@EventHandler
public void spawnHolograms(PlayerToggleSneakEvent event)
{
if (!isActive(event.getPlayer()))
return;
if (event.isSneaking())
return;
if (!Recharge.Instance.use(event.getPlayer(), getName(), COOLDOWN, true, false, "Cosmetics"))
return;
Location randomLoc = event.getPlayer().getLocation().clone();
int[] rPos = new int[]{-2, -1, 0, 1, 2};
int rX = rPos[UtilMath.random.nextInt(rPos.length)], rZ = rPos[UtilMath.random.nextInt(rPos.length)];
randomLoc.add(rX, 1, rZ);
String quote = _quotes.get(UtilMath.random.nextInt(_quotes.size()));
Hologram hologram;
if (quote.contains("\n"))
{
String[] lines = quote.split("\n");
hologram = new Hologram(Manager.getHologramManager(), randomLoc, true, HOLOGRAM_TIME, lines);
}
else
{
hologram = new Hologram(Manager.getHologramManager(), randomLoc, true, HOLOGRAM_TIME, quote);
}
hologram.start();
}
}

View File

@ -0,0 +1,184 @@
package mineplex.core.gadget.gadgets.particle.spring;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.arcadeevents.CoreGameStartEvent;
import mineplex.core.arcadeevents.CoreGameStopEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.RGBData;
import mineplex.core.common.util.UtilColor;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilTime;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.OutfitGadget;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.particleeffects.ColoredCircleEffect;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ParticleSpringHalo extends ParticleGadget
{
private Map<Player, ColoredCircleEffect> _effects = new HashMap<>();
private List<SpringHaloData> _springHaloData = new ArrayList<>();
private Map<Player, List<SpringHaloData>> _playerSpringHaloData = new HashMap<>();
private boolean _enableTrail = true;
public ParticleSpringHalo(GadgetManager manager)
{
super(manager, "Spring Halo", UtilText.splitLinesToArray(new String[]{C.cGray + "Spring is everywhere, if you look hard enough."}, LineFormat.LORE),
-19, Material.YELLOW_FLOWER, (byte) 0);
}
@Override
public void enableCustom(Player player, boolean message)
{
super.enableCustom(player, message);
Manager.removeGadgetType(player, GadgetType.MORPH, this);
Manager.removeOutfit(player, OutfitGadget.ArmorSlot.HELMET);
ColoredCircleEffect circleEffect = new ColoredCircleEffect(Manager.getPlugin(), player, 0.7d, false);
RGBData colorA = UtilColor.hexToRgb(0x5a92ed);
RGBData colorB = UtilColor.hexToRgb(0xdb5aed);
RGBData colorC = UtilColor.hexToRgb(0xd2cdf2);
RGBData colorD = UtilColor.hexToRgb(0x7c6df2);
RGBData colorE = UtilColor.hexToRgb(0xedeb97);
RGBData colorF = UtilColor.hexToRgb(0xeac07c);
circleEffect.addColors(colorA, colorB, colorC, colorD, colorE, colorF);
circleEffect.setYOffset(2.3d);
circleEffect.start();
_effects.put(player, circleEffect);
player.getEquipment().setHelmet(new ItemStack(Material.RED_ROSE, 1, (byte) 8));
}
@Override
public void disableCustom(Player player, boolean message)
{
super.disableCustom(player, message);
if (_effects.containsKey(player))
{
ColoredCircleEffect circleEffect = _effects.get(player);
if (circleEffect != null)
{
circleEffect.stop();
}
}
_effects.remove(player);
player.getInventory().setHelmet(null);
if (_playerSpringHaloData.containsKey(player))
{
Iterator<SpringHaloData> iterator = _playerSpringHaloData.get(player).iterator();
while (iterator.hasNext())
{
SpringHaloData springHaloData = iterator.next();
springHaloData.getBlock().setType(Material.AIR);
springHaloData.getBlock().setData((byte) 0);
iterator.remove();
}
_playerSpringHaloData.get(player).clear();
_playerSpringHaloData.remove(player);
}
}
@Override
public void playParticle(Player player, UpdateEvent event)
{
}
@EventHandler
public void spawnFlowers(PlayerMoveEvent event)
{
if (!isActive(event.getPlayer()))
return;
if (!_enableTrail)
return;
Player player = event.getPlayer();
Block block = event.getFrom().getBlock();
if (block.getType() != Material.AIR)
return;
if (block.getLocation().subtract(0, 1, 0).getBlock().getType() != Material.GRASS
&& block.getLocation().subtract(0, 1, 0).getBlock().getType() != Material.DIRT)
return;
block.setType(Material.RED_ROSE);
block.setData((byte) UtilMath.random.nextInt(8));
SpringHaloData springHaloData = new SpringHaloData(player, block, System.currentTimeMillis());
addFlower(player, springHaloData);
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<SpringHaloData> iterator = _springHaloData.iterator();
while (iterator.hasNext())
{
SpringHaloData springHaloData = iterator.next();
if (UtilTime.elapsed(springHaloData.getSpawned(), 1500))
{
springHaloData.getBlock().setType(Material.AIR);
springHaloData.getBlock().setData((byte) 0);
removeSpringHalo(springHaloData);
iterator.remove();
}
}
}
private void addFlower(Player player, SpringHaloData springHaloData)
{
_springHaloData.add(springHaloData);
if (_playerSpringHaloData.containsKey(player))
{
List<SpringHaloData> list = _playerSpringHaloData.get(player);
list.add(springHaloData);
}
else
{
List<SpringHaloData> list = new ArrayList<>();
list.add(springHaloData);
_playerSpringHaloData.put(player, list);
}
}
private void removeSpringHalo(SpringHaloData springHaloData)
{
Player player = springHaloData.getPlayer();
List<SpringHaloData> list = _playerSpringHaloData.get(player);
if (list != null)
{
list.remove(springHaloData);
}
}
@EventHandler
public void onGameStart(CoreGameStartEvent event)
{
_enableTrail = false;
}
@EventHandler
public void onGameEnd(CoreGameStopEvent event)
{
_enableTrail = true;
}
}

View File

@ -0,0 +1,34 @@
package mineplex.core.gadget.gadgets.particle.spring;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
public class SpringHaloData
{
private Player _player;
private Block _block;
private long _spawned;
public SpringHaloData(Player player, Block block, long spawned)
{
_player = player;
_block = block;
_spawned = spawned;
}
public Player getPlayer()
{
return _player;
}
public Block getBlock()
{
return _block;
}
public long getSpawned()
{
return _spawned;
}
}

View File

@ -30,6 +30,7 @@ import mineplex.core.events.EnableArcadeSpawnEvent;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
import mineplex.core.gadget.types.TauntGadget; import mineplex.core.gadget.types.TauntGadget;
import mineplex.core.game.GameDisplay;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -53,7 +54,7 @@ public class EternalTaunt extends TauntGadget
setPvpCooldown(PVP_COOLDOWN); setPvpCooldown(PVP_COOLDOWN);
setShouldPlay(true); setShouldPlay(true);
setEventType(UpdateType.FAST); setEventType(UpdateType.FAST);
addDisabledGames(GameType.SMASH, GameType.SMASHTEAMS, GameType.SMASHDOMINATION); addDisabledGames(GameDisplay.Smash, GameDisplay.SmashTeams, GameDisplay.SmashDomination);
} }
@Override @Override

View File

@ -1,84 +0,0 @@
package mineplex.core.gadget.gadgets.taunts;
public enum GameType
{
BACONBRAWL,
BARBARIANS,
BASKETBALL,
BOSSBATTLES,
BRIDGE,
CASTLESIEGE,
CHAMPIONSCTF,
CHAMPIONSDOMINATE,
CHAMPIONSTDM,
CHRISTMAS,
DEATHTAG,
DRAGONESCAPE,
DRAGONESCAPETEAMS,
DRAGONRIDERS,
DRAGONS,
DRAGONSTEAMS,
DRAW,
ELYTRARINGS,
EVOLUTION,
GRAVITY,
HALLOWEEN,
HALLOWEEN2016,
HIDESEEK,
HOLEINTHEWALL,
HORSE,
LOBBERS,
MICRO,
MILKCOW,
MINESTRIKE,
BAWKBAWKBATTLES,
MINECRAFTLEAGUE,
OLDMINEWARE,
PAINTBALL,
QUIVER,
QUIVERPAYLOAD,
QUIVERTEAMS,
RUNNER,
SEARCHANDDESTROY,
SHEEP,
TYPEWARS,
SMASH,
SMASHDOMINATION,
SMASHTEAMS,
SNAKE,
SNEAKYASSASSINS,
SNOWFIGHT,
SPEEDBUILDERS,
SPLEEF,
SPLEEFTEAMS,
SQUIDSHOOTER,
STACKER,
SURVIVALGAMES,
SURVIVALGAMESTEAMS,
TUG,
TURFWARS,
UHC,
UHCSOLO,
UHCSOLOSPEED,
UHCTEAMSSPEED,
WITHERASSAULT,
WIZARDS,
ZOMBIESURVIVAL,
BUILD,
BUILDMAVERICKS,
CARDS,
SKYWARS,
SKYWARSTEAMS,
MONSTERMAZE,
MONSTERLEAGUE,
GLADIATORS,
SKYFALL,
SKYFALLTEAMS,
BOUNCYBALLS,
VALENTINES,
EVENT,
BRAWL,
NONE
}

View File

@ -0,0 +1,23 @@
package mineplex.core.gadget.set;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.arrowtrail.spring.ArrowTrailSpring;
import mineplex.core.gadget.gadgets.death.spring.DeathSpring;
import mineplex.core.gadget.gadgets.doublejump.spring.DoubleJumpSpring;
import mineplex.core.gadget.gadgets.particle.spring.ParticleSpringHalo;
import mineplex.core.gadget.types.GadgetSet;
public class SetSpring extends GadgetSet
{
public SetSpring(GadgetManager manager)
{
// TODO LORE
super(manager, "Spring", "2x Holiday Points while active (Titles)",
manager.getGadget(ArrowTrailSpring.class),
manager.getGadget(DeathSpring.class),
manager.getGadget(DoubleJumpSpring.class),
manager.getGadget(ParticleSpringHalo.class));
}
}

View File

@ -10,6 +10,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
@ -114,6 +115,19 @@ public abstract class BalloonGadget extends Gadget
{ {
Map.Entry<UUID, Map<EntityType, BalloonData>> entry = iterator.next(); Map.Entry<UUID, Map<EntityType, BalloonData>> entry = iterator.next();
for (BalloonData balloonData : entry.getValue().values()) for (BalloonData balloonData : entry.getValue().values())
{
balloonData.teleport();
}
}
}
@EventHandler
public void onPlayerMove(PlayerMoveEvent event)
{
if (PLAYER_BALLOONS.containsKey(event.getPlayer().getUniqueId()))
{
Map<EntityType, BalloonData> balloons = PLAYER_BALLOONS.get(event.getPlayer().getUniqueId());
for (BalloonData balloonData : balloons.values())
{ {
balloonData.update(); balloonData.update();
} }

View File

@ -32,7 +32,7 @@ public abstract class ParticleGadget extends Gadget
super(manager, GadgetType.PARTICLE, name, desc, cost, mat, data, 1, altNames); super(manager, GadgetType.PARTICLE, name, desc, cost, mat, data, 1, altNames);
} }
public ParticleGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, YearMonth yearMonth, String...altNames) public ParticleGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, YearMonth yearMonth, String... altNames)
{ {
super(manager, GadgetType.PARTICLE, name, desc, cost, mat, data, yearMonth, 1, altNames); super(manager, GadgetType.PARTICLE, name, desc, cost, mat, data, yearMonth, 1, altNames);
} }

View File

@ -13,7 +13,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.taunts.GameType; import mineplex.core.game.GameDisplay;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -32,7 +32,7 @@ public abstract class TauntGadget extends Gadget
/** Sets when the taunt will run, if set above */ /** Sets when the taunt will run, if set above */
private UpdateType _updateType = UpdateType.TICK; private UpdateType _updateType = UpdateType.TICK;
/** List of games where this item is disabled */ /** List of games where this item is disabled */
private List<GameType> _disabledGames = new ArrayList<>(); private List<GameDisplay> _disabledGames = new ArrayList<>();
/** The ticks that passed since the player started the effect */ /** The ticks that passed since the player started the effect */
private Map<UUID, Integer> _ticksPerPlayer = new HashMap<>(); private Map<UUID, Integer> _ticksPerPlayer = new HashMap<>();
@ -119,7 +119,7 @@ public abstract class TauntGadget extends Gadget
_updateType = updateType; _updateType = updateType;
} }
public void addDisabledGames(GameType... disabledGames) public void addDisabledGames(GameDisplay... disabledGames)
{ {
_disabledGames.addAll(Arrays.asList(disabledGames)); _disabledGames.addAll(Arrays.asList(disabledGames));
} }
@ -129,9 +129,9 @@ public abstract class TauntGadget extends Gadget
return _canPlayWithPvp; return _canPlayWithPvp;
} }
public boolean isGameDisabled(GameType gameType) public boolean isGameDisabled(GameDisplay gameDisplay)
{ {
return _disabledGames.contains(gameType); return _disabledGames.contains(gameDisplay);
} }
public long getPvpCooldown() public long getPvpCooldown()

View File

@ -50,6 +50,12 @@ public class BalloonData
((LivingEntity) _balloon).setLeashHolder(_player); ((LivingEntity) _balloon).setLeashHolder(_player);
} }
public void teleport()
{
_balloon.teleport(_balloonLoc);
_balloon.setVelocity(new Vector(0, 3, 0));
}
public void update() public void update()
{ {
if (_leash == null) if (_leash == null)

View File

@ -25,15 +25,15 @@ public class LocationConstants
public static final Location[] CHEST_LOCATIONS = { public static final Location[] CHEST_LOCATIONS = {
new Location(WORLD, 34, 72, -15), new Location(WORLD, 34, 72, -15),
new Location(WORLD, 23, 72, -31), new Location(WORLD, 26, 72, -35),
new Location(WORLD, -23, 72, -31), new Location(WORLD, -23, 72, -31),
new Location(WORLD, -34, 72, -15) new Location(WORLD, -34, 72, -15)
}; };
//new Location(world, -25.5, 73, 19.5), new Location(world, -35.5, 69, 1.5) //new Location(world, -25.5, 73, 19.5), new Location(world, -35.5, 69, 1.5)
public static final Location FOUNTAIN_SCHEMATIC = new Location(WORLD, -35.5, 68, 1.5); public static final Location FOUNTAIN_SCHEMATIC = new Location(WORLD, -41.5, 68, 5.5);
public static final Location FOUNTAIN_LOCATION = new Location(WORLD, -24.5, 72, 24.5); public static final Location FOUNTAIN_LOCATION = new Location(WORLD, -30.5, 72, 28.5);
public static Location getResetLocation(Location chestLocation) public static Location getResetLocation(Location chestLocation)
{ {

View File

@ -1,6 +1,7 @@
package mineplex.core.loot; package mineplex.core.loot;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
@ -32,9 +33,32 @@ public class ChestLoot
public ItemStack getLoot() public ItemStack getLoot()
{ {
int no = UtilMath.r(_totalLoot); return getLoot(new ArrayList<>());
}
for (RandomItem item : _randomItems) public ItemStack getLoot(ArrayList<Material> exclude)
{
int totalLoot = _totalLoot;
ArrayList<RandomItem> items = (ArrayList<RandomItem>) _randomItems.clone();
Iterator<RandomItem> rItems = items.iterator();
while (rItems.hasNext())
{
RandomItem item = rItems.next();
for (Material mat : exclude)
{
if (item.getItemStack().getType() == mat)
{
totalLoot -= item.getAmount();
rItems.remove();
}
}
}
int no = UtilMath.r(totalLoot);
for (RandomItem item : items)
{ {
no -= item.getAmount(); no -= item.getAmount();

View File

@ -48,4 +48,15 @@ public class RandomItem
return _item; return _item;
} }
@Override
public boolean equals(Object obj)
{
if (!(obj instanceof RandomItem))
return false;
RandomItem item = (RandomItem) obj;
return _item.getType() == item.getItemStack().getType();
}
} }

View File

@ -123,6 +123,11 @@ public class LagMeter extends MiniPlugin
return _ticksPerSecond; return _ticksPerSecond;
} }
public double getRecentTicksPercentageAverage()
{
return _ticksPerSecondAverage;
}
private void sendUpdates() private void sendUpdates()
{ {
for (Player player : _monitoring) for (Player player : _monitoring)

View File

@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -23,6 +24,7 @@ public class CircleEffect extends Effect
private List<Color> _randomColors = new ArrayList<>(); private List<Color> _randomColors = new ArrayList<>();
private int _maxCircles = -1; private int _maxCircles = -1;
private int _totalCircles = 0; private int _totalCircles = 0;
private double _yOffset = 0.0;
private static final double RANDOM_COLOR_CHANCE = 0.5; private static final double RANDOM_COLOR_CHANCE = 0.5;
private static final int PARTICLES_PER_CIRCLE = 20; private static final int PARTICLES_PER_CIRCLE = 20;
@ -40,6 +42,14 @@ public class CircleEffect extends Effect
_instantly = instantly; _instantly = instantly;
} }
public CircleEffect(JavaPlugin plugin, Entity entity, double radius, Color color, boolean instantly)
{
super(-1, new EffectLocation(entity), plugin);
_radius = radius;
_color = color;
_instantly = instantly;
}
public void addRandomColor(Color color) public void addRandomColor(Color color)
{ {
_randomColors.add(color); _randomColors.add(color);
@ -50,6 +60,11 @@ public class CircleEffect extends Effect
_maxCircles = circles; _maxCircles = circles;
} }
public void setYOffset(double yOffset)
{
_yOffset = yOffset;
}
@Override @Override
public void runEffect() public void runEffect()
{ {
@ -57,7 +72,7 @@ public class CircleEffect extends Effect
{ {
for (int i = 0; i < PARTICLES_PER_CIRCLE; i++) for (int i = 0; i < PARTICLES_PER_CIRCLE; i++)
{ {
Location location = getEffectLocation().getFixedLocation(); Location location = getEffectLocation().getLocation().add(0, _yOffset, 0);
double increment = (2 * Math.PI) / PARTICLES_PER_CIRCLE; double increment = (2 * Math.PI) / PARTICLES_PER_CIRCLE;
double angle = _steps * increment; double angle = _steps * increment;
Vector vector = new Vector(Math.cos(angle) * _radius, 0, Math.sin(angle) * _radius); Vector vector = new Vector(Math.cos(angle) * _radius, 0, Math.sin(angle) * _radius);
@ -86,7 +101,7 @@ public class CircleEffect extends Effect
return; return;
} }
} }
Location location = getEffectLocation().getFixedLocation(); Location location = getEffectLocation().getLocation().add(0, _yOffset, 0);
double increment = (2 * Math.PI) / PARTICLES_PER_CIRCLE; double increment = (2 * Math.PI) / PARTICLES_PER_CIRCLE;
double angle = _steps * increment; double angle = _steps * increment;
Vector vector = new Vector(Math.cos(angle) * _radius, 0, Math.sin(angle) * _radius); Vector vector = new Vector(Math.cos(angle) * _radius, 0, Math.sin(angle) * _radius);

View File

@ -0,0 +1,122 @@
package mineplex.core.particleeffects;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import mineplex.core.common.util.RGBData;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.particles.ColoredParticle;
import mineplex.core.common.util.particles.DustSpellColor;
public class ColoredCircleEffect extends Effect
{
private double _radius;
private List<Color> _colors;
private int _steps = 0;
private boolean _instantly = true;
private int _maxCircles = -1;
private int _totalCircles = 0;
private double _yOffset = 0.0;
private static final int PARTICLES_PER_CIRCLE = 20;
public ColoredCircleEffect(JavaPlugin plugin, Entity entity, double radius, boolean instantly, Color... colors)
{
super(-1, new EffectLocation(entity), plugin);
_radius = radius;
_colors = new ArrayList<>();
_instantly = instantly;
Collections.addAll(_colors, colors);
}
public void setMaxCircles(int circles)
{
_maxCircles = circles;
}
public void setYOffset(double yOffset)
{
_yOffset = yOffset;
}
public void addColor(Color color)
{
_colors.add(color);
}
public void addColors(Color... colors)
{
Collections.addAll(_colors, colors);
}
public void addColor(RGBData rgbData)
{
_colors.add(new Color(rgbData.getFullRed(), rgbData.getFullGreen(), rgbData.getFullBlue()));
}
public void addColors(RGBData... rgbDatas)
{
for (RGBData rgbData : rgbDatas)
{
addColor(rgbData);
}
}
@Override
public void runEffect()
{
if (_instantly)
{
for (int i = 0; i < PARTICLES_PER_CIRCLE; i++)
{
Location location = getEffectLocation().getLocation().add(0, _yOffset, 0);
double increment = (2 * Math.PI) / PARTICLES_PER_CIRCLE;
double angle = _steps * increment;
Vector vector = new Vector(Math.cos(angle) * _radius, 0, Math.sin(angle) * _radius);
ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(getNextColor()), location.add(vector));
coloredParticle.display();
_steps++;
}
stop();
}
else
{
if (_maxCircles != -1)
{
if (_totalCircles >= _maxCircles)
{
stop();
return;
}
}
Location location = getEffectLocation().getLocation().add(0, _yOffset, 0);
double increment = (2 * Math.PI) / PARTICLES_PER_CIRCLE;
double angle = _steps * increment;
Vector vector = new Vector(Math.cos(angle) * _radius, 0, Math.sin(angle) * _radius);
ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(getNextColor()), location.add(vector));
coloredParticle.display();
_steps++;
if (_steps >= PARTICLES_PER_CIRCLE)
{
_totalCircles++;
_steps = 0;
}
}
}
private Color getNextColor()
{
int r = UtilMath.random.nextInt(_colors.size());
return _colors.get(r);
}
}

View File

@ -1,7 +1,7 @@
package mineplex.core.pet; package mineplex.core.pet;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Creature; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -17,13 +17,13 @@ public class FlyingPetManager
*/ */
private Player _player; private Player _player;
private Creature _pet; private Entity _pet;
private Location _grimReaperLoc, _target; private Location _grimReaperLoc, _target;
private Vector _direction; private Vector _direction;
private double _speed; private double _speed;
private long _idleTime; private long _idleTime;
public FlyingPetManager(Player player, Creature pet) public FlyingPetManager(Player player, Entity pet)
{ {
_player = player; _player = player;
_pet = pet; _pet = pet;

View File

@ -22,6 +22,7 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPigZombie;
import org.bukkit.entity.Ageable; import org.bukkit.entity.Ageable;
import org.bukkit.entity.Blaze; import org.bukkit.entity.Blaze;
import org.bukkit.entity.Creature; import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.PigZombie; import org.bukkit.entity.PigZombie;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -54,7 +55,6 @@ import mineplex.core.common.Rank;
import mineplex.core.common.shape.ShapeWings; import mineplex.core.common.shape.ShapeWings;
import mineplex.core.common.skin.SkinData; import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
@ -88,17 +88,17 @@ public class PetManager extends MiniClientPlugin<PetClient>
private BlockRestore _blockRestore; private BlockRestore _blockRestore;
private Map<String, PetType> _activePetOwnerTypes = new HashMap<>(); private Map<String, PetType> _activePetOwnerTypes = new HashMap<>();
private NautHashMap<String, Creature> _activePetOwners; private Map<String, Entity> _activePetOwners;
private NautHashMap<String, Integer> _failedAttempts; private Map<String, Integer> _failedAttempts;
private Map<String, PetType> _petOwnerQueue = new HashMap<>(); private Map<String, PetType> _petOwnerQueue = new HashMap<>();
private NautHashMap<String, String> _petRenameQueue = new NautHashMap<String, String>(); private Map<String, String> _petRenameQueue = new HashMap<>();
private DonationManager _donationManager; private DonationManager _donationManager;
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
private InventoryManager _inventoryManager; private InventoryManager _inventoryManager;
private Map<Creature, FlyingPetManager> _flyingPets = new HashMap<>(); private Map<Entity, FlyingPetManager> _flyingPets = new HashMap<>();
private Map<Creature, TrueLoveData> _trueLovePets = new HashMap<>(); private Map<Entity, TrueLoveData> _trueLovePets = new HashMap<>();
private ShapeWings _grimReaperWings = new ShapeWings(ParticleType.RED_DUST.particleName, new org.bukkit.util.Vector(0.2, 0.2, 0.2), 1, 0, false, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN); private ShapeWings _grimReaperWings = new ShapeWings(ParticleType.RED_DUST.particleName, new org.bukkit.util.Vector(0.2, 0.2, 0.2), 1, 0, false, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN);
private ShapeWings _grimReaperWingsEdge = new ShapeWings(ParticleType.RED_DUST.particleName, new org.bukkit.util.Vector(0.1, 0.1, 0.1), 1, 0, true, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN); private ShapeWings _grimReaperWingsEdge = new ShapeWings(ParticleType.RED_DUST.particleName, new org.bukkit.util.Vector(0.1, 0.1, 0.1), 1, 0, true, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN);
@ -120,8 +120,8 @@ public class PetManager extends MiniClientPlugin<PetClient>
_clientManager = clientManager; _clientManager = clientManager;
_inventoryManager = inventoryManager; _inventoryManager = inventoryManager;
_activePetOwners = new NautHashMap<String, Creature>(); _activePetOwners = new HashMap<>();
_failedAttempts = new NautHashMap<String, Integer>(); _failedAttempts = new HashMap<>();
} }
public void addPetOwnerToQueue(String playerName, PetType petType) public void addPetOwnerToQueue(String playerName, PetType petType)
@ -169,7 +169,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
if (player != null && player.isOnline()) if (player != null && player.isOnline())
{ {
Creature activePet = getActivePet(playerName); Entity activePet = getActivePet(playerName);
if (activePet != null) if (activePet != null)
{ {
activePet.setCustomNameVisible(true); activePet.setCustomNameVisible(true);
@ -213,7 +213,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
return; return;
} }
Creature pet; Entity pet;
EntityType entityType = petType.getEntityType(); EntityType entityType = petType.getEntityType();
//Wither Spawn //Wither Spawn
@ -221,7 +221,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
{ {
_creatureModule.SetForce(true); _creatureModule.SetForce(true);
pet = (Creature) location.getWorld().spawnEntity(location, EntityType.SILVERFISH); pet = location.getWorld().spawnEntity(location, EntityType.SILVERFISH);
UtilEnt.silence(pet, true); UtilEnt.silence(pet, true);
DisguiseWither witherDisguise = new DisguiseWither(pet); DisguiseWither witherDisguise = new DisguiseWither(pet);
@ -258,33 +258,35 @@ public class PetManager extends MiniClientPlugin<PetClient>
} }
} }
} }
pet = (Creature)_creatureModule.SpawnEntity(location, petType.getEntityType()); pet = _creatureModule.SpawnEntity(location, petType.getEntityType());
} }
//Default Spawn //Default Spawn
else else
{ {
pet = (Creature)_creatureModule.SpawnEntity(location, petType.getEntityType()); pet = _creatureModule.SpawnEntity(location, petType.getEntityType());
} }
//Named Pet //Named Pet
if (Get(player).getPets().get(petType) != null && Get(player).getPets().get(petType).length() > 0) if (Get(player).getPets().get(petType) != null && Get(player).getPets().get(petType).length() > 0)
{ {
//pet.setCustomNameVisible(true); pet.setCustomNameVisible(true);
pet.setCustomName(Get(player).getPets().get(petType)); pet.setCustomName(Get(player).getPets().get(petType));
} }
if (petType.equals(PetType.ZOMBIE)) if (petType.equals(PetType.ZOMBIE))
{ {
((Zombie) pet).setBaby(true); Zombie zombie = (Zombie) pet;
pet.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); zombie.setBaby(true);
pet.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 0)); zombie.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN));
zombie.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 0));
UtilEnt.silence(pet, true); UtilEnt.silence(pet, true);
} }
if (pet instanceof PigZombie) if (pet instanceof PigZombie)
{ {
((PigZombie)pet).setBaby(true); PigZombie pigZombie = (PigZombie) pet;
pet.getEquipment().setHelmet(new ItemStack(Material.SKULL_ITEM, 1, (short)0, (byte) 1)); pigZombie.setBaby(true);
pet.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 0)); pigZombie.getEquipment().setHelmet(new ItemStack(Material.SKULL_ITEM, 1, (short)0, (byte) 1));
pigZombie.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 0));
} }
else if (pet instanceof Villager) else if (pet instanceof Villager)
{ {
@ -293,10 +295,11 @@ public class PetManager extends MiniClientPlugin<PetClient>
} }
else if (pet instanceof Skeleton) else if (pet instanceof Skeleton)
{ {
pet.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); //stop burning Skeleton skeleton = (Skeleton) pet;
skeleton.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); //stop burning
UtilEnt.silence(pet, true); UtilEnt.silence(pet, true);
DisguiseGuardian disguise = new DisguiseGuardian(pet); DisguiseGuardian disguise = new DisguiseGuardian(skeleton);
if (Get(player).getPets().get(petType) != null && Get(player).getPets().get(petType).length() > 0) if (Get(player).getPets().get(petType) != null && Get(player).getPets().get(petType).length() > 0)
{ {
@ -306,7 +309,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
_disguiseManager.disguise(disguise); _disguiseManager.disguise(disguise);
} }
else if (pet instanceof Rabbit) else if (petType.equals(PetType.RABBIT))
{ {
UtilEnt.silence(pet, true); UtilEnt.silence(pet, true);
DisguiseChicken disguise = new DisguiseChicken(pet); DisguiseChicken disguise = new DisguiseChicken(pet);
@ -410,6 +413,12 @@ public class PetManager extends MiniClientPlugin<PetClient>
zombie.getEquipment().setLeggings(ItemStackFactory.Instance.createColoredLeatherArmor(2, org.bukkit.Color.fromRGB(0, 153, 0))); zombie.getEquipment().setLeggings(ItemStackFactory.Instance.createColoredLeatherArmor(2, org.bukkit.Color.fromRGB(0, 153, 0)));
zombie.getEquipment().setBoots(ItemStackFactory.Instance.createColoredLeatherArmor(3, org.bukkit.Color.fromRGB(0, 153, 0))); zombie.getEquipment().setBoots(ItemStackFactory.Instance.createColoredLeatherArmor(3, org.bukkit.Color.fromRGB(0, 153, 0)));
} }
else if (petType.equals(PetType.KILLER_BUNNY))
{
Rabbit rabbit = (Rabbit) pet;
rabbit.setAdult();
rabbit.setRabbitType(Rabbit.Type.THE_KILLER_BUNNY);
}
_activePetOwnerTypes.put(player.getName(), petType); _activePetOwnerTypes.put(player.getName(), petType);
_activePetOwners.put(player.getName(), pet); _activePetOwners.put(player.getName(), pet);
@ -424,7 +433,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
UtilEnt.vegetate(pet); UtilEnt.vegetate(pet);
} }
public Creature getPet(Player player) public Entity getPet(Player player)
{ {
return _activePetOwners.get(player.getName()); return _activePetOwners.get(player.getName());
} }
@ -433,7 +442,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
{ {
if (_activePetOwners.containsKey(player.getName())) if (_activePetOwners.containsKey(player.getName()))
{ {
final Creature pet = _activePetOwners.get(player.getName()); final Entity pet = _activePetOwners.get(player.getName());
//Wither Silverfish //Wither Silverfish
if (pet.getPassenger() != null) if (pet.getPassenger() != null)
@ -494,7 +503,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
{ {
String playerName = null; String playerName = null;
for (Entry<String,Creature> entry : _activePetOwners.entrySet()) for (Entry<String, Entity> entry : _activePetOwners.entrySet())
{ {
if (entry.getValue() == event.getEntity()) if (entry.getValue() == event.getEntity())
playerName = entry.getKey(); playerName = entry.getKey();
@ -518,28 +527,28 @@ public class PetManager extends MiniClientPlugin<PetClient>
public void onUpdate(UpdateEvent event) public void onUpdate(UpdateEvent event)
{ {
for (Entry<String, Creature> entry : _activePetOwners.entrySet()) for (Entry<String, Entity> entry : _activePetOwners.entrySet())
{ {
String playerName = entry.getKey(); String playerName = entry.getKey();
Creature creature = entry.getValue(); Entity entity = entry.getValue();
if (event.getType() == UpdateType.TICK) if (event.getType() == UpdateType.TICK)
{ {
if (creature instanceof PigZombie) if (entity instanceof PigZombie)
{ {
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, creature.getLocation(), 0.2f, 0.0f, 0.2f, 0.0f, 4, ViewDist.NORMAL); UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, entity.getLocation(), 0.2f, 0.0f, 0.2f, 0.0f, 4, ViewDist.NORMAL);
if(event.getTick() % 3 == 0) creature.getWorld().playSound(creature.getLocation(), Sound.BLAZE_BREATH, 0.03f, 0f); if(event.getTick() % 3 == 0) entity.getWorld().playSound(entity.getLocation(), Sound.BLAZE_BREATH, 0.03f, 0f);
if(!((CraftPigZombie) creature).getHandle().isSilent()) if(!((CraftPigZombie) entity).getHandle().isSilent())
{ {
((CraftPigZombie) creature).getHandle().setSilent(true); ((CraftPigZombie) entity).getHandle().setSilent(true);
} }
} }
} }
else if (event.getType() == UpdateType.FAST) else if (event.getType() == UpdateType.FAST)
{ {
if (creature instanceof Blaze) if (entity instanceof Blaze)
{ {
Location loc = creature.getLocation().clone().add(0, .5, 0).add(creature.getLocation().getDirection().multiply(-0.2)); Location loc = entity.getLocation().clone().add(0, .5, 0).add(entity.getLocation().getDirection().multiply(-0.2));
_grimReaperWings.display(loc); _grimReaperWings.display(loc);
_grimReaperWingsEdge.display(loc); _grimReaperWingsEdge.display(loc);
} }
@ -548,7 +557,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
PetType petType = getActivePetType(playerName); PetType petType = getActivePetType(playerName);
if (petType == PetType.CUPID_PET) if (petType == PetType.CUPID_PET)
{ {
Location loc = creature.getLocation().clone().add(0, .5, 0).add(creature.getLocation().getDirection().multiply(-0.2)); Location loc = entity.getLocation().clone().add(0, .5, 0).add(entity.getLocation().getDirection().multiply(-0.2));
_cupidWings.displayColored(loc, Color.PINK); _cupidWings.displayColored(loc, Color.PINK);
_cupidWingsWhite.displayColored(loc, Color.WHITE); _cupidWingsWhite.displayColored(loc, Color.WHITE);
@ -561,7 +570,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
PetType petType = getActivePetType(playerName); PetType petType = getActivePetType(playerName);
if (petType == PetType.CUPID_PET) if (petType == PetType.CUPID_PET)
{ {
Location loc = creature.getLocation().clone().add(0, .5, 0); Location loc = entity.getLocation().clone().add(0, .5, 0);
UtilParticle.PlayParticle(ParticleType.HEART, loc, 0.25f, 0.25f, 0.25f, 0.25f, 3, ViewDist.NORMAL); UtilParticle.PlayParticle(ParticleType.HEART, loc, 0.25f, 0.25f, 0.25f, 0.25f, 3, ViewDist.NORMAL);
} }
} }
@ -581,7 +590,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
String playerName = ownerIterator.next(); String playerName = ownerIterator.next();
Player owner = Bukkit.getPlayer(playerName); Player owner = Bukkit.getPlayer(playerName);
Creature pet = _activePetOwners.get(playerName); Entity pet = _activePetOwners.get(playerName);
Location petSpot = pet.getLocation(); Location petSpot = pet.getLocation();
Location ownerSpot = owner.getLocation(); Location ownerSpot = owner.getLocation();
xDiff = Math.abs(petSpot.getBlockX() - ownerSpot.getBlockX()); xDiff = Math.abs(petSpot.getBlockX() - ownerSpot.getBlockX());
@ -657,7 +666,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
@EventHandler @EventHandler
public void grimReaperFly(UpdateEvent event) public void grimReaperFly(UpdateEvent event)
{ {
for (Entry<Creature, FlyingPetManager> entry : _flyingPets.entrySet()) for (Entry<Entity, FlyingPetManager> entry : _flyingPets.entrySet())
{ {
FlyingPetManager flyingPetManager = entry.getValue(); FlyingPetManager flyingPetManager = entry.getValue();
flyingPetManager.update(); flyingPetManager.update();
@ -670,11 +679,11 @@ public class PetManager extends MiniClientPlugin<PetClient>
if (event.getType() != UpdateType.FASTEST) if (event.getType() != UpdateType.FASTEST)
return; return;
Iterator<Entry<Creature, TrueLoveData>> iterator = _trueLovePets.entrySet().iterator(); Iterator<Entry<Entity, TrueLoveData>> iterator = _trueLovePets.entrySet().iterator();
while (iterator.hasNext()) while (iterator.hasNext())
{ {
Entry<Creature, TrueLoveData> entry = iterator.next(); Entry<Entity, TrueLoveData> entry = iterator.next();
Creature zombie = entry.getKey(); Entity zombie = entry.getKey();
UtilParticle.PlayParticle(ParticleType.HEART, zombie.getLocation().add(0, 0.25, 0), 0.25f, 0.25f, 0.25f, 0, 1, ViewDist.NORMAL); UtilParticle.PlayParticle(ParticleType.HEART, zombie.getLocation().add(0, 0.25, 0), 0.25f, 0.25f, 0.25f, 0, 1, ViewDist.NORMAL);
TrueLoveData trueLoveData = entry.getValue(); TrueLoveData trueLoveData = entry.getValue();
trueLoveData.update(); trueLoveData.update();
@ -690,7 +699,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
{ {
if (event.getEntity() instanceof Zombie) if (event.getEntity() instanceof Zombie)
{ {
if (_activePetOwners.containsValue((Creature) event.getEntity())) if (_activePetOwners.containsValue(event.getEntity()))
{ {
event.setCancelled(true); event.setCancelled(true);
} }
@ -718,7 +727,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
return _activePetOwnerTypes.get(name); return _activePetOwnerTypes.get(name);
} }
public Creature getActivePet(String name) public Entity getActivePet(String name)
{ {
return _activePetOwners.get(name); return _activePetOwners.get(name);
} }
@ -734,7 +743,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
removePet(player, true); removePet(player, true);
} }
public Collection<Creature> getPets() public Collection<Entity> getPets()
{ {
return _activePetOwners.values(); return _activePetOwners.values();
} }
@ -744,4 +753,9 @@ public class PetManager extends MiniClientPlugin<PetClient>
return _creatureModule; return _creatureModule;
} }
public DisguiseManager getDisguiseManager()
{
return _disguiseManager;
}
} }

View File

@ -33,7 +33,8 @@ public enum PetType
GINGERBREAD_MAN("Gingerbread Man", EntityType.ZOMBIE, -16, "Looks like you can catch him after all."), GINGERBREAD_MAN("Gingerbread Man", EntityType.ZOMBIE, -16, "Looks like you can catch him after all."),
CUPID_PET("Cupid", EntityType.ZOMBIE, -17, "Sometimes you need a little extra help finding true Love. Why not have Cupid help you out?", Material.BOW, (byte) 0), CUPID_PET("Cupid", EntityType.ZOMBIE, -17, "Sometimes you need a little extra help finding true Love. Why not have Cupid help you out?", Material.BOW, (byte) 0),
TRUE_LOVE_PET("True Love", EntityType.ZOMBIE, -14, "Sometimes love means chasing the person of your dreams until you catch them.", Material.APPLE, YearMonth.of(2017, Month.FEBRUARY)), TRUE_LOVE_PET("True Love", EntityType.ZOMBIE, -14, "Sometimes love means chasing the person of your dreams until you catch them.", Material.APPLE, YearMonth.of(2017, Month.FEBRUARY)),
LEPRECHAUN("Leprechaun", EntityType.ZOMBIE, -18, "Apparently this little guy lost his Pot of Gold in the war.", SkinData.LEPRECHAUN.getSkull()) LEPRECHAUN("Leprechaun", EntityType.ZOMBIE, -18, "Apparently this little guy lost his Pot of Gold in the war.", SkinData.LEPRECHAUN.getSkull()),
KILLER_BUNNY("Killer Bunny", EntityType.RABBIT, -19, "The Easter Bunny's less talked about brother Devin was a bit less fun to hang out with.", Material.RABBIT_FOOT, (byte) 0)
// TODO CHECK IF LOBBY IS 1.9+ // TODO CHECK IF LOBBY IS 1.9+
// Not in this update // Not in this update
//SHULKER("Shulker Pet", EntityType.BAT, 0, "Is it a turtle or an alien? Either way its shot can be really UPLIFTING.") //SHULKER("Shulker Pet", EntityType.BAT, 0, "Is it a turtle or an alien? Either way its shot can be really UPLIFTING.")

View File

@ -0,0 +1,168 @@
package mineplex.core.pet.custom;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.donation.DonationManager;
import mineplex.core.pet.PetManager;
public abstract class CustomPet
{
private static Map<Player, CustomPet> _customPet = new HashMap<>();
protected PetManager _petManager;
protected Player _player;
protected EntityType _entityType;
protected int _step = 0;
private String _name;
private List<String> _lines = new ArrayList<>();
public CustomPet(PetManager petManager, Player player, EntityType entityType)
{
_petManager = petManager;
_player = player;
_entityType = entityType;
_customPet.put(player, this);
}
public void spawn(Entity entity)
{
UtilEnt.silence(entity, true);
onSpawn(entity);
}
public abstract void onSpawn(Entity entity);
public abstract GadgetPage getNextStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager);
public abstract GadgetPage getPreviousStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager);
public void setName(String name)
{
_name = name;
}
public String getName()
{
return _name;
}
public void addLine(String lineKey, String lineValue)
{
_lines.add(C.cGray + lineKey + ": " + F.name(lineValue));
}
public void addLine(String lineKey, String lineValue, int i)
{
_lines.add(i, C.cGray + lineKey + ": " + F.name(lineValue));
}
protected void addTypeLine(String type)
{
addLine("Type", type);
}
public List<String> getLines()
{
return _lines;
}
public ItemStack getCustomPetDescription()
{
ItemStack itemStack = new ItemStack(Material.PAPER);
ItemMeta meta = itemStack.getItemMeta();
if (_name != null)
{
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', _name));
}
else
{
meta.setDisplayName("Custom Pet");
}
meta.setLore(_lines);
itemStack.setItemMeta(meta);
return itemStack;
}
public static CustomPet getCustomPet(Player player)
{
if (_customPet.containsKey(player))
{
return _customPet.get(player);
}
return null;
}
public static void removeCustomPet(Player player)
{
if (_customPet.containsKey(player))
{
_customPet.remove(player);
}
}
public enum CustomPetType
{
ZOMBIE("Zombie", Material.GLASS);
private String _name;
private Material _material;
private byte _data;
CustomPetType(String name, Material material, byte data)
{
_name = name;
_material = material;
_data = data;
}
CustomPetType(String name, Material material)
{
this(name, material, (byte) 0);
}
public String getName()
{
return _name;
}
public Material getMaterial()
{
return _material;
}
public byte getData()
{
return _data;
}
public CustomPet getCustomPet(PetManager petManager, Player player)
{
switch (this)
{
case ZOMBIE:
return new CustomPetZombie(petManager, player);
default:
return new CustomPetZombie(petManager, player);
}
}
}
}

View File

@ -0,0 +1,28 @@
package mineplex.core.pet.custom;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import mineplex.core.pet.PetManager;
public abstract class CustomPetAgeable extends CustomPet
{
private boolean _baby = false;
public CustomPetAgeable(PetManager petManager, Player player, EntityType entityType)
{
super(petManager, player, entityType);
}
public void setBaby(boolean baby)
{
_baby = baby;
addLine("Age", (baby) ? "Baby" : "Adult");
}
protected boolean isBaby()
{
return _baby;
}
}

View File

@ -0,0 +1,66 @@
package mineplex.core.pet.custom;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.pet.PetManager;
public abstract class CustomPetEquipment extends CustomPetAgeable
{
private ItemStack _helmet;
private ItemStack _chestplate;
private ItemStack _leggings;
private ItemStack _boots;
public CustomPetEquipment(PetManager petManager, Player player, EntityType entityType)
{
super(petManager, player, entityType);
}
public void setHelmet(ItemStack helmet)
{
_helmet = helmet;
addLine("Helmet", (helmet.getType() == Material.AIR) ? "None" : helmet.getItemMeta().getDisplayName());
}
public void setChestplate(ItemStack chestplate)
{
_chestplate = chestplate;
addLine("Chestplate", (chestplate.getType() == Material.AIR) ? "None" : chestplate.getItemMeta().getDisplayName());
}
public void setLeggings(ItemStack leggings)
{
_leggings = leggings;
addLine("Leggings", (leggings.getType() == Material.AIR) ? "None" : leggings.getItemMeta().getDisplayName());
}
public void setBoots(ItemStack boots)
{
_boots = boots;
addLine("Boots", (boots.getType() == Material.AIR) ? "None" : boots.getItemMeta().getDisplayName());
}
public ItemStack getHelmet()
{
return _helmet;
}
public ItemStack getChestplate()
{
return _chestplate;
}
public ItemStack getLeggings()
{
return _leggings;
}
public ItemStack getBoots()
{
return _boots;
}
}

View File

@ -0,0 +1,149 @@
package mineplex.core.pet.custom;
import org.bukkit.ChatColor;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.cosmetic.ui.page.custompet.CustomPetBasePage;
import mineplex.core.cosmetic.ui.page.custompet.CustomPetConfirmPage;
import mineplex.core.cosmetic.ui.page.custompet.age.CustomPetAgePage;
import mineplex.core.cosmetic.ui.page.custompet.equipment.CustomPetBootsPage;
import mineplex.core.cosmetic.ui.page.custompet.equipment.CustomPetChestplatePage;
import mineplex.core.cosmetic.ui.page.custompet.equipment.CustomPetHelmetPage;
import mineplex.core.cosmetic.ui.page.custompet.equipment.CustomPetLeggingsPage;
import mineplex.core.cosmetic.ui.page.custompet.name.CustomPetNamePage;
import mineplex.core.cosmetic.ui.page.custompet.zombie.CustomPetZombieTypePage;
import mineplex.core.disguise.disguises.DisguiseZombie;
import mineplex.core.donation.DonationManager;
import mineplex.core.pet.PetManager;
public class CustomPetZombie extends CustomPetEquipment
{
private boolean _villager = false;
public CustomPetZombie(PetManager petManager, Player player)
{
super(petManager, player, EntityType.ZOMBIE);
addTypeLine("Zombie");
}
@Override
public void onSpawn(Entity entity)
{
DisguiseZombie disguiseZombie = new DisguiseZombie(entity);
disguiseZombie.setBaby(isBaby());
disguiseZombie.setVillager(_villager);
if (getHelmet() != null)
{
disguiseZombie.setHelmet(getHelmet());
}
if (getChestplate() != null)
{
disguiseZombie.setChestplate(getChestplate());
}
if (getLeggings() != null)
{
disguiseZombie.setLeggings(getLeggings());
}
if (getBoots() != null)
{
disguiseZombie.setBoots(getBoots());
}
if (getName() != null)
{
disguiseZombie.setCustomNameVisible(true);
disguiseZombie.setName(ChatColor.translateAlternateColorCodes('&', getName()));
}
else
{
disguiseZombie.setCustomNameVisible(false);
}
_petManager.getDisguiseManager().disguise(disguiseZombie);
}
@Override
public GadgetPage getNextStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager)
{
switch (_step)
{
case 0:
_step++;
return new CustomPetNamePage(plugin, shop, clientManager, donationManager, "Zombie Name", _player);
case 1:
_step++;
return new CustomPetAgePage(plugin, shop, clientManager, donationManager, "Zombie Age", _player);
case 2:
_step++;
return new CustomPetHelmetPage(plugin, shop, clientManager, donationManager, "Zombie Helmet", _player);
case 3:
_step++;
return new CustomPetChestplatePage(plugin, shop, clientManager, donationManager, "Zombie Chestplate", _player);
case 4:
_step++;
return new CustomPetLeggingsPage(plugin, shop, clientManager, donationManager, "Zombie Leggings", _player);
case 5:
_step++;
return new CustomPetBootsPage(plugin, shop, clientManager, donationManager, "Zombie Boots", _player);
case 6:
_step++;
return new CustomPetZombieTypePage(plugin, shop, clientManager, donationManager, "Zombie Type", _player);
case 7:
_step++;
return new CustomPetConfirmPage(plugin, shop, clientManager, donationManager, "Confirm", _player);
default:
_step++;
return new CustomPetAgePage(plugin, shop, clientManager, donationManager, "Zombie Age", _player);
}
}
@Override
public GadgetPage getPreviousStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager)
{
switch (_step)
{
case 1:
_step--;
return new CustomPetBasePage(plugin, shop, clientManager, donationManager, "Custom Pet", _player);
case 2:
_step--;
return new CustomPetNamePage(plugin, shop, clientManager, donationManager, "Zombie Name", _player);
case 3:
_step--;
return new CustomPetAgePage(plugin, shop, clientManager, donationManager, "Zombie Age", _player);
case 4:
_step--;
return new CustomPetHelmetPage(plugin, shop, clientManager, donationManager, "Zombie Helmet", _player);
case 5:
_step--;
return new CustomPetChestplatePage(plugin, shop, clientManager, donationManager, "Zombie Chestplate", _player);
case 6:
_step--;
return new CustomPetLeggingsPage(plugin, shop, clientManager, donationManager, "Zombie Leggings", _player);
case 7:
_step--;
return new CustomPetBootsPage(plugin, shop, clientManager, donationManager, "Zombie Boots", _player);
case 8:
_step--;
return new CustomPetZombieTypePage(plugin, shop, clientManager, donationManager, "Zombie Type", _player);
default:
_step--;
return new CustomPetBasePage(plugin, shop, clientManager, donationManager, "Custom Pet", _player);
}
}
public void setVillager(boolean villager)
{
_villager = villager;
}
public boolean isVillager()
{
return _villager;
}
}

View File

@ -50,7 +50,7 @@ public class GiveawayMessageHandler implements CommandCallback
String playerName = message.getPlayerName(); String playerName = message.getPlayerName();
int count = message.getEternalCount(); int count = message.getEternalCount();
String countString = count + UtilTime.getDayOfMonthSuffix(count); String countString = count + UtilTime.getDayOfMonthSuffix(count);
String chatMessage = C.cPurple + playerName + C.cWhite + " found Eternal Rank in a " + C.cPurple + "Thanksgiving Chicken"; String chatMessage = C.cPurple + playerName + C.cWhite + " found Eternal Rank in an " + C.cPurple + "Easter Egg Basket";
UtilTextMiddle.display(C.cDPurple + C.Bold + "ETERNAL", chatMessage, 20, 80, 20, UtilServer.getPlayers()); UtilTextMiddle.display(C.cDPurple + C.Bold + "ETERNAL", chatMessage, 20, 80, 20, UtilServer.getPlayers());
World world = UtilServer.getPlayers().length > 0 ? UtilServer.getPlayers()[0].getWorld() : Bukkit.getWorlds().get(0); World world = UtilServer.getPlayers().length > 0 ? UtilServer.getPlayers()[0].getWorld() : Bukkit.getWorlds().get(0);
LightFlicker lightFlicker = new LightFlicker(world); LightFlicker lightFlicker = new LightFlicker(world);

View File

@ -15,7 +15,7 @@ import mineplex.core.common.Rank;
import mineplex.core.common.util.banner.CountryFlag; import mineplex.core.common.util.banner.CountryFlag;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHalloween; import mineplex.core.gadget.gadgets.arrowtrail.halloween.ArrowTrailHalloween;
import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane; import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane;
import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid; import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid;
import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald; import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald;
@ -25,6 +25,7 @@ import mineplex.core.gadget.gadgets.arrowtrail.howlingwinds.ArrowTrailStorm;
import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic; import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic;
import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti; import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti;
import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow; import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow;
import mineplex.core.gadget.gadgets.arrowtrail.spring.ArrowTrailSpring;
import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood; import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood;
import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant; import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant;
import mineplex.core.gadget.gadgets.balloons.BalloonType; import mineplex.core.gadget.gadgets.balloons.BalloonType;
@ -38,9 +39,10 @@ import mineplex.core.gadget.gadgets.death.howlingwinds.DeathStorm;
import mineplex.core.gadget.gadgets.death.music.DeathMusic; import mineplex.core.gadget.gadgets.death.music.DeathMusic;
import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst; import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst;
import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; import mineplex.core.gadget.gadgets.death.shadow.DeathShadow;
import mineplex.core.gadget.gadgets.death.spring.DeathSpring;
import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; import mineplex.core.gadget.gadgets.death.vampire.DeathBlood;
import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHalloween; import mineplex.core.gadget.gadgets.doublejump.halloween.DoubleJumpHalloween;
import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane; import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane;
import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings; import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings;
import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald; import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald;
@ -50,6 +52,7 @@ import mineplex.core.gadget.gadgets.doublejump.howlingwinds.DoubleJumpStorm;
import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic; import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic;
import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker; import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker;
import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow; import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow;
import mineplex.core.gadget.gadgets.doublejump.spring.DoubleJumpSpring;
import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood; import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood;
import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant; import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant;
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin; import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin;
@ -67,6 +70,7 @@ import mineplex.core.gadget.gadgets.item.ItemPaintballGun;
import mineplex.core.gadget.gadgets.item.ItemPartyPopper; import mineplex.core.gadget.gadgets.item.ItemPartyPopper;
import mineplex.core.gadget.gadgets.item.ItemSnowball; import mineplex.core.gadget.gadgets.item.ItemSnowball;
import mineplex.core.gadget.gadgets.item.ItemTNT; import mineplex.core.gadget.gadgets.item.ItemTNT;
import mineplex.core.gadget.gadgets.morph.MorphAwkwardRabbit;
import mineplex.core.gadget.gadgets.morph.MorphBat; import mineplex.core.gadget.gadgets.morph.MorphBat;
import mineplex.core.gadget.gadgets.morph.MorphBlock; import mineplex.core.gadget.gadgets.morph.MorphBlock;
import mineplex.core.gadget.gadgets.morph.MorphBunny; import mineplex.core.gadget.gadgets.morph.MorphBunny;
@ -115,6 +119,7 @@ import mineplex.core.gadget.gadgets.particle.howlingwinds.ParticleRain;
import mineplex.core.gadget.gadgets.particle.music.ParticleMusic; import mineplex.core.gadget.gadgets.particle.music.ParticleMusic;
import mineplex.core.gadget.gadgets.particle.party.ParticlePartyTime; import mineplex.core.gadget.gadgets.particle.party.ParticlePartyTime;
import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot; import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot;
import mineplex.core.gadget.gadgets.particle.spring.ParticleSpringHalo;
import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood; import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood;
import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant;
import mineplex.core.gadget.gadgets.taunts.BlowAKissTaunt; import mineplex.core.gadget.gadgets.taunts.BlowAKissTaunt;
@ -565,7 +570,7 @@ public class RewardManager
addReward(Type.TRICK_OR_TREAT, new SpinTicketReward(_clientManager, 1, 3, rarity, 150, 0)); addReward(Type.TRICK_OR_TREAT, new SpinTicketReward(_clientManager, 1, 3, rarity, 150, 0));
addReward(Type.TRICK_OR_TREAT, new GameAmplifierReward(_inventoryManager, 1, 2, rarity, 150, 0)); addReward(Type.TRICK_OR_TREAT, new GameAmplifierReward(_inventoryManager, 1, 2, rarity, 150, 0));
addReward(Type.TRICK_OR_TREAT, new RuneAmplifierReward(_inventoryManager, 20, 1, 3, rarity, 120, 0)); addReward(Type.TRICK_OR_TREAT, new RuneAmplifierReward(_inventoryManager, 20, 1, 3, rarity, 120, 0));
addReward(Type.TRICK_OR_TREAT, new UnknownPackageReward(_donationManager, "Clan Banner Access", "Wear/Place Clan Banner", "Clan Banner Usage", new ItemStack(Material.BANNER), rarity, 110, 0)); addReward(Type.TRICK_OR_TREAT, new UnknownPackageReward(_donationManager, _inventoryManager, "Clan Banner Access", "Wear/Place Clan Banner", "Clan Banner Usage", new ItemStack(Material.BANNER), rarity, 110, 0));
addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.OLD, 1, 5, rarity, 150, 0)); addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.OLD, 1, 5, rarity, 150, 0));
addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.ANCIENT, 1, 5, rarity, 80, 0)); addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.ANCIENT, 1, 5, rarity, 80, 0));
@ -578,7 +583,7 @@ public class RewardManager
// THANKFUL // THANKFUL
addReward(Type.THANKFUL, new SpinTicketReward(_clientManager, 1, 3, rarity, 150, 0)); addReward(Type.THANKFUL, new SpinTicketReward(_clientManager, 1, 3, rarity, 150, 0));
addReward(Type.THANKFUL, new RuneAmplifierReward(_inventoryManager, 20, 1, 3, rarity, 120, 0)); addReward(Type.THANKFUL, new RuneAmplifierReward(_inventoryManager, 20, 1, 3, rarity, 120, 0));
addReward(Type.THANKFUL, new UnknownPackageReward(_donationManager, "Clan Banner Access", "Wear/Place Clan Banner", "Clan Banner Usage", new ItemStack(Material.BANNER), rarity, 110, 0)); addReward(Type.THANKFUL, new UnknownPackageReward(_donationManager, _inventoryManager, "Clan Banner Access", "Wear/Place Clan Banner", "Clan Banner Usage", new ItemStack(Material.BANNER), rarity, 110, 0));
addReward(Type.THANKFUL, new ChestReward(_inventoryManager, TreasureType.OLD, 1, 5, rarity, 150, 0)); addReward(Type.THANKFUL, new ChestReward(_inventoryManager, TreasureType.OLD, 1, 5, rarity, 150, 0));
addReward(Type.THANKFUL, new ChestReward(_inventoryManager, TreasureType.ANCIENT, 1, 5, rarity, 80, 0)); addReward(Type.THANKFUL, new ChestReward(_inventoryManager, TreasureType.ANCIENT, 1, 5, rarity, 80, 0));
@ -599,6 +604,11 @@ public class RewardManager
addGadget(Type.STPATRICKS, getGadget(OutfitStPatricksChestplate.class), rarity, 50); addGadget(Type.STPATRICKS, getGadget(OutfitStPatricksChestplate.class), rarity, 50);
addGadget(Type.STPATRICKS, getGadget(OutfitStPatricksLeggings.class), rarity, 50); addGadget(Type.STPATRICKS, getGadget(OutfitStPatricksLeggings.class), rarity, 50);
addGadget(Type.STPATRICKS, getGadget(OutfitStPatricksBoots.class), rarity, 50); addGadget(Type.STPATRICKS, getGadget(OutfitStPatricksBoots.class), rarity, 50);
// SPRING
addGadget(Type.SPRING, getGadget(ArrowTrailSpring.class), rarity, 100);
addGadget(Type.SPRING, getGadget(DeathSpring.class), rarity, 100);
addGadget(Type.SPRING, getGadget(DoubleJumpSpring.class), rarity, 100);
} }
public void addLegendary() public void addLegendary()
@ -856,6 +866,12 @@ public class RewardManager
addPetReward(Type.STPATRICKS, PetType.LEPRECHAUN, rarity, 30); addPetReward(Type.STPATRICKS, PetType.LEPRECHAUN, rarity, 30);
addMount(Type.STPATRICKS, getMount(MountStPatricksHorse.class), rarity, 30); addMount(Type.STPATRICKS, getMount(MountStPatricksHorse.class), rarity, 30);
// SPRING
addGadget(Type.SPRING, getGadget(ParticleSpringHalo.class), rarity, 100);
addGadget(Type.SPRING, getGadget(MorphAwkwardRabbit.class), rarity, 25);
addPetReward(Type.SPRING, PetType.KILLER_BUNNY, rarity, 50);
} }
public UnknownPackageReward addMount(Type type, Mount<?> mount, RewardRarity rarity, int weight) public UnknownPackageReward addMount(Type type, Mount<?> mount, RewardRarity rarity, int weight)
@ -865,7 +881,7 @@ public class RewardManager
public UnknownPackageReward addMount(Type type, Mount<?> mount, RewardRarity rarity, int weight, int shards) public UnknownPackageReward addMount(Type type, Mount<?> mount, RewardRarity rarity, int weight, int shards)
{ {
UnknownPackageReward reward = new UnknownPackageReward(_donationManager, "Mount", mount.getDisplayName(), mount.getName(), UnknownPackageReward reward = new UnknownPackageReward(_donationManager, _inventoryManager, "Mount", mount.getDisplayName(), mount.getName(),
new ItemStack(mount.getDisplayMaterial(), 1, (short) 0, (byte) mount.getDisplayData()), rarity, weight, shards); new ItemStack(mount.getDisplayMaterial(), 1, (short) 0, (byte) mount.getDisplayData()), rarity, weight, shards);
addReward(type, reward); addReward(type, reward);
return reward; return reward;
@ -891,7 +907,7 @@ public class RewardManager
public UnknownPackageReward addHatReward(RewardPool.Type type, HatGadget gadget, RewardRarity rarity, int weight) public UnknownPackageReward addHatReward(RewardPool.Type type, HatGadget gadget, RewardRarity rarity, int weight)
{ {
UnknownPackageReward reward = UnknownPackageReward reward =
new UnknownPackageReward(_donationManager, gadget.getGadgetType().getCategoryType(), gadget.getDisplayName(), new UnknownPackageReward(_donationManager, _inventoryManager, gadget.getGadgetType().getCategoryType(), gadget.getDisplayName(),
gadget.getName(), gadget.getHelmetItem(), rarity, weight, getShards(rarity)); gadget.getName(), gadget.getHelmetItem(), rarity, weight, getShards(rarity));
addReward(type, reward); addReward(type, reward);
return reward; return reward;
@ -918,7 +934,7 @@ public class RewardManager
display = gadget.getDisplayItem(); display = gadget.getDisplayItem();
} }
UnknownPackageReward reward = UnknownPackageReward reward =
new UnknownPackageReward(_donationManager, gadget.getGadgetType().getCategoryType(), displayName, new UnknownPackageReward(_donationManager, _inventoryManager, gadget.getGadgetType().getCategoryType(), displayName,
gadget.getName(), display, rarity, gadget.getName(), display, rarity,
weight, shards, gadget.getAlternativePackageNames()); weight, shards, gadget.getAlternativePackageNames());
addReward(type, reward); addReward(type, reward);

View File

@ -65,6 +65,7 @@ public class RewardPool
MINESTRIKE(true, 2), MINESTRIKE(true, 2),
LOVECHEST(false, 1), LOVECHEST(false, 1),
STPATRICKS(false, 1), STPATRICKS(false, 1),
SPRING(false, 1),
CARL_SPINNER(true); CARL_SPINNER(true);
private boolean _useDuplicates; private boolean _useDuplicates;

View File

@ -22,6 +22,7 @@ public enum RewardType
LOVE_CHEST( 0, 6, 18, 0), LOVE_CHEST( 0, 6, 18, 0),
VALENTINES_GIFT( 0, 7, 20, 20), VALENTINES_GIFT( 0, 7, 20, 20),
ST_PATRICKS( 0, 6, 18, 0), ST_PATRICKS( 0, 6, 18, 0),
SPRING( 0, 6, 18, 0),
SPINNER_FILLER( 0.1, 1, 4, 20), SPINNER_FILLER( 0.1, 1, 4, 20),
SPINNER_REAL( 0.000001, 0.05, 0.4, 5); SPINNER_REAL( 0.000001, 0.05, 0.4, 5);

View File

@ -26,7 +26,7 @@ public class PetReward extends UnknownPackageReward
public PetReward(PetManager petManager, InventoryManager inventoryManager, DonationManager donationManager, String name, String packageName, PetType petType, RewardRarity rarity, int weight, int shardValue) public PetReward(PetManager petManager, InventoryManager inventoryManager, DonationManager donationManager, String name, String packageName, PetType petType, RewardRarity rarity, int weight, int shardValue)
{ {
super(donationManager, "Pet", name, packageName, new ItemStack(Material.MONSTER_EGG, 1, petType.getEntityType().getTypeId()), rarity, weight, shardValue); super(donationManager, inventoryManager, "Pet", name, packageName, new ItemStack(Material.MONSTER_EGG, 1, petType.getEntityType().getTypeId()), rarity, weight, shardValue);
_petManager = petManager; _petManager = petManager;
_inventoryManager = inventoryManager; _inventoryManager = inventoryManager;

View File

@ -1,13 +1,15 @@
package mineplex.core.reward.rewards; package mineplex.core.reward.rewards;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.reward.Reward; import mineplex.core.reward.Reward;
import mineplex.core.reward.RewardData; import mineplex.core.reward.RewardData;
import mineplex.core.reward.RewardRarity; import mineplex.core.reward.RewardRarity;
import mineplex.core.reward.RewardType; import mineplex.core.reward.RewardType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
/** /**
* Created by shaun on 14-09-12. * Created by shaun on 14-09-12.
@ -15,16 +17,18 @@ import org.bukkit.inventory.ItemStack;
public class UnknownPackageReward extends Reward public class UnknownPackageReward extends Reward
{ {
protected DonationManager _donationManager; protected DonationManager _donationManager;
protected InventoryManager _inventoryManager;
private ItemStack _itemStack; private ItemStack _itemStack;
private String _header; private String _header;
private String _name; private String _name;
private String _packageName; private String _packageName;
private String[] _alternativeNames; private String[] _alternativeNames;
public UnknownPackageReward(DonationManager donationManager, String header, String name, String packageName, ItemStack itemStack, RewardRarity rarity, int weight, int shardValue) public UnknownPackageReward(DonationManager donationManager, InventoryManager inventoryManager, String header, String name, String packageName, ItemStack itemStack, RewardRarity rarity, int weight, int shardValue)
{ {
super(rarity, weight, shardValue); super(rarity, weight, shardValue);
_donationManager = donationManager; _donationManager = donationManager;
_inventoryManager = inventoryManager;
_header = header; _header = header;
_name = name; _name = name;
_packageName = packageName; _packageName = packageName;
@ -32,10 +36,11 @@ public class UnknownPackageReward extends Reward
_alternativeNames = new String[]{}; _alternativeNames = new String[]{};
} }
public UnknownPackageReward(DonationManager donationManager, String header, String name, String packageName, ItemStack itemStack, RewardRarity rarity, int weight, int shardValue, String... alternativeNames) public UnknownPackageReward(DonationManager donationManager, InventoryManager inventoryManager, String header, String name, String packageName, ItemStack itemStack, RewardRarity rarity, int weight, int shardValue, String... alternativeNames)
{ {
super(rarity, weight, shardValue); super(rarity, weight, shardValue);
_donationManager = donationManager; _donationManager = donationManager;
_inventoryManager = inventoryManager;
_header = header; _header = header;
_name = name; _name = name;
_packageName = packageName; _packageName = packageName;
@ -64,6 +69,10 @@ public class UnknownPackageReward extends Reward
{ {
hasItem = true; hasItem = true;
} }
else if (_inventoryManager.Get(player).getItemCount(_packageName) > 0)
{
hasItem = true;
}
else else
{ {
for (String altName : _alternativeNames) for (String altName : _alternativeNames)
@ -72,6 +81,10 @@ public class UnknownPackageReward extends Reward
{ {
hasItem = true; hasItem = true;
} }
if (_inventoryManager.Get(player).getItemCount(altName) > 0)
{
hasItem = true;
}
} }
} }
return !hasItem; return !hasItem;

View File

@ -1,9 +1,7 @@
package mineplex.core.status; package mineplex.core.status;
import java.io.File; import java.io.File;
import java.lang.reflect.Constructor;
import java.util.Collection; import java.util.Collection;
import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -11,12 +9,6 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.event.server.ServerListPingEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.PropertyMap;
import com.mojang.util.UUIDTypeAdapter;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Constants; import mineplex.core.common.Constants;
@ -166,7 +158,7 @@ public class ServerStatusManager extends MiniPlugin
String motd = _enabled ? event.getMotd() : "Restarting"; String motd = _enabled ? event.getMotd() : "Restarting";
int playerCount = _clientManager.getPlayerCountIncludingConnecting(); int playerCount = _clientManager.getPlayerCountIncludingConnecting();
int maxPlayerCount = event.getMaxPlayers(); int maxPlayerCount = event.getMaxPlayers();
int tps = (int) _lagMeter.getTicksPerSecond(); int tps = (int) Math.max(_lagMeter.getRecentTicksPercentageAverage(), _lagMeter.getTicksPerSecond());
String address = Bukkit.getServer().getIp().isEmpty() ? "localhost" : Bukkit.getServer().getIp(); String address = Bukkit.getServer().getIp().isEmpty() ? "localhost" : Bukkit.getServer().getIp();
int port = _plugin.getServer().getPort(); int port = _plugin.getServer().getPort();
String group = _plugin.getConfig().getString("serverstatus.group") + ""; String group = _plugin.getConfig().getString("serverstatus.group") + "";

View File

@ -22,6 +22,7 @@ import mineplex.core.gadget.gadgets.item.ItemSnowball;
import mineplex.core.gadget.set.SetCupidsLove; import mineplex.core.gadget.set.SetCupidsLove;
import mineplex.core.gadget.set.SetFreedom; import mineplex.core.gadget.set.SetFreedom;
import mineplex.core.gadget.set.SetFrostLord; import mineplex.core.gadget.set.SetFrostLord;
import mineplex.core.gadget.set.SetSpring;
import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetSet; import mineplex.core.gadget.types.GadgetSet;
import mineplex.core.titles.tracks.Track; import mineplex.core.titles.tracks.Track;
@ -52,10 +53,12 @@ public class HolidayCheerTrack extends Track
HOLIDAY_CHESTS.add(TreasureType.GINGERBREAD); HOLIDAY_CHESTS.add(TreasureType.GINGERBREAD);
HOLIDAY_CHESTS.add(TreasureType.LOVE_CHEST); HOLIDAY_CHESTS.add(TreasureType.LOVE_CHEST);
HOLIDAY_CHESTS.add(TreasureType.ST_PATRICKS); HOLIDAY_CHESTS.add(TreasureType.ST_PATRICKS);
HOLIDAY_CHESTS.add(TreasureType.SPRING);
HOLIDAY_SETS.add(SetFreedom.class); HOLIDAY_SETS.add(SetFreedom.class);
HOLIDAY_SETS.add(SetCupidsLove.class); HOLIDAY_SETS.add(SetCupidsLove.class);
HOLIDAY_SETS.add(SetFrostLord.class); HOLIDAY_SETS.add(SetFrostLord.class);
HOLIDAY_SETS.add(SetSpring.class);
} }
private final GadgetManager _gadgetManager = Managers.require(GadgetManager.class); private final GadgetManager _gadgetManager = Managers.require(GadgetManager.class);

View File

@ -39,6 +39,7 @@ public class LuckyTrack extends Track
MULTIPLIER.put(TreasureType.TRICK_OR_TREAT, 2); MULTIPLIER.put(TreasureType.TRICK_OR_TREAT, 2);
MULTIPLIER.put(TreasureType.LOVE_CHEST, 2); MULTIPLIER.put(TreasureType.LOVE_CHEST, 2);
MULTIPLIER.put(TreasureType.ST_PATRICKS, 2); MULTIPLIER.put(TreasureType.ST_PATRICKS, 2);
MULTIPLIER.put(TreasureType.SPRING, 2);
MULTIPLIER.put(TreasureType.OMEGA, 3); MULTIPLIER.put(TreasureType.OMEGA, 3);
IRON.add(Material.IRON_SPADE); IRON.add(Material.IRON_SPADE);

View File

@ -31,6 +31,7 @@ public class TreasureHunterTrack extends Track
POINTS.put(TreasureType.GINGERBREAD, 25); POINTS.put(TreasureType.GINGERBREAD, 25);
POINTS.put(TreasureType.LOVE_CHEST, 25); POINTS.put(TreasureType.LOVE_CHEST, 25);
POINTS.put(TreasureType.ST_PATRICKS, 25); POINTS.put(TreasureType.ST_PATRICKS, 25);
POINTS.put(TreasureType.SPRING, 25);
POINTS.put(TreasureType.OMEGA, 50); POINTS.put(TreasureType.OMEGA, 50);
POINTS.put(TreasureType.MINESTRIKE, 3); POINTS.put(TreasureType.MINESTRIKE, 3);
} }

View File

@ -224,6 +224,15 @@ public class Treasure
block.getLocation().add(.5 + rX, .7, .5 + rZ)); block.getLocation().add(.5 + rX, .7, .5 + rZ));
coloredParticle.display(); coloredParticle.display();
} }
else if (_treasureType == TreasureType.SPRING)
{
int r = (int) (Math.random() * 2);
double rX = Math.random() * 2 - 1, rZ = Math.random() * 2 - 1;
ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST,
new DustSpellColor((r == 0) ? Color.RED : Color.YELLOW),
block.getLocation().add(.5 + rX, .7, .5 + rZ));
coloredParticle.display();
}
else else
{ {
UtilParticle.PlayParticle(type, block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0.2F, 0, UtilParticle.PlayParticle(type, block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0.2F, 0,

View File

@ -97,6 +97,13 @@ public enum TreasureStyle
ParticleType.HAPPY_VILLAGER, ParticleType.HAPPY_VILLAGER,
Sound.VILLAGER_YES, Sound.VILLAGER_YES,
Sound.VILLAGER_YES Sound.VILLAGER_YES
),
SPRING(
ParticleType.RED_DUST,
ParticleType.RED_DUST,
ParticleType.RED_DUST,
Sound.STEP_GRASS,
Sound.STEP_GRASS
); );
private ParticleType _secondaryParticle; private ParticleType _secondaryParticle;

View File

@ -34,7 +34,9 @@ public enum TreasureType
LOVE_CHEST(C.cRed + "Love Treasure", "Love Chest", "LoveChest", RewardType.LOVE_CHEST, Material.CHEST, TreasureStyle.LOVECHEST, RewardPool.Type.LOVECHEST, true, 20000), LOVE_CHEST(C.cRed + "Love Treasure", "Love Chest", "LoveChest", RewardType.LOVE_CHEST, Material.CHEST, TreasureStyle.LOVECHEST, RewardPool.Type.LOVECHEST, true, 20000),
ST_PATRICKS(C.cGreen + "St Patrick's Treasure", "St Patricks Chest", "StPatricksChest", RewardType.ST_PATRICKS, Material.CHEST, TreasureStyle.STPATRICKS,RewardPool.Type.STPATRICKS, true, 20000); ST_PATRICKS(C.cGreen + "St Patrick's Treasure", "St Patricks Chest", "StPatricksChest", RewardType.ST_PATRICKS, Material.CHEST, TreasureStyle.STPATRICKS,RewardPool.Type.STPATRICKS, true, 20000),
SPRING(C.cGreen + "Spring Treasure", "Spring Chest", "SpringChest", RewardType.SPRING, Material.CHEST, TreasureStyle.SPRING, RewardPool.Type.SPRING, true, 20000);
private final String _name; private final String _name;
private final RewardType _rewardType; private final RewardType _rewardType;

View File

@ -1,5 +1,6 @@
package mineplex.core.treasure.animation; package mineplex.core.treasure.animation;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.bukkit.Material; import org.bukkit.Material;
@ -7,8 +8,10 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.Skull; import org.bukkit.block.Skull;
import mineplex.core.common.MaterialData;
import mineplex.core.common.skin.SkinData; import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.BlockInfo;
import mineplex.core.treasure.Treasure; import mineplex.core.treasure.Treasure;
import mineplex.core.treasure.TreasureType; import mineplex.core.treasure.TreasureType;
@ -99,6 +102,10 @@ public class BlockChangeAnimation extends Animation
mat = Material.WOOL; mat = Material.WOOL;
data = 13; data = 13;
} }
else if (getTreasure().getTreasureType() == TreasureType.SPRING)
{
mat = Material.GRASS;
}
else else
continue; continue;
@ -151,6 +158,11 @@ public class BlockChangeAnimation extends Animation
mat = Material.GOLD_BLOCK; mat = Material.GOLD_BLOCK;
data = 0; data = 0;
} }
else if (getTreasure().getTreasureType() == TreasureType.SPRING)
{
mat = Material.DIRT;
data = 2;
}
else else
continue; continue;
@ -245,6 +257,27 @@ public class BlockChangeAnimation extends Animation
} }
} }
} }
else if (getTreasure().getTreasureType() == TreasureType.SPRING)
{
List<MaterialData> materials = new ArrayList<>();
materials.add(MaterialData.of(Material.LEAVES, (byte) 0));
materials.add(MaterialData.of(Material.LEAVES, (byte) 1));
materials.add(MaterialData.of(Material.LEAVES, (byte) 2));
materials.add(MaterialData.of(Material.LEAVES, (byte) 3));
materials.add(MaterialData.of(Material.LEAVES_2, (byte) 0));
materials.add(MaterialData.of(Material.LEAVES_2, (byte) 1));
for (Block c : _chests)
{
if (c.equals(b))
{
_blockInfoList.add(new BlockInfo(b));
int r = UtilMath.random.nextInt(materials.size());
MaterialData materialData = materials.get(r);
b.setType(materialData.getMaterial());
b.setData(materialData.getData());
}
}
}
} }
} }
@ -256,7 +289,6 @@ public class BlockChangeAnimation extends Animation
@Override @Override
protected void onFinish() protected void onFinish()
{ {
} }
private byte getDirection(Block block) private byte getDirection(Block block)

View File

@ -1,22 +1,32 @@
package mineplex.core.treasure.animation; package mineplex.core.treasure.animation;
import java.awt.Color; import java.awt.Color;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.MathHelper; import net.minecraft.server.v1_8_R3.MathHelper;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.entity.ArmorStand; import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Item;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import mineplex.core.Managers; import mineplex.core.Managers;
import mineplex.core.common.MaterialData;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
@ -30,13 +40,14 @@ import mineplex.core.common.util.particles.ColoredParticle;
import mineplex.core.common.util.particles.DustSpellColor; import mineplex.core.common.util.particles.DustSpellColor;
import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseBat; import mineplex.core.disguise.disguises.DisguiseBat;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.particleeffects.BabyFireworkEffect; import mineplex.core.particleeffects.BabyFireworkEffect;
import mineplex.core.particleeffects.CircleEffect; import mineplex.core.particleeffects.CircleEffect;
import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.BlockInfo;
import mineplex.core.treasure.Treasure; import mineplex.core.treasure.Treasure;
import mineplex.core.treasure.TreasureType; import mineplex.core.treasure.TreasureType;
public class ChestSpawnAnimation extends Animation public class ChestSpawnAnimation extends Animation implements Listener
{ {
private static final int ANIMATION_DURATION = 80; private static final int ANIMATION_DURATION = 80;
@ -47,6 +58,8 @@ public class ChestSpawnAnimation extends Animation
private Location _particleLocation; private Location _particleLocation;
private Vector _particleDirection; private Vector _particleDirection;
private Location _openingCenter;
private List<BlockInfo> _chestBlockInfo; private List<BlockInfo> _chestBlockInfo;
private double _radialOffset; private double _radialOffset;
@ -58,6 +71,8 @@ public class ChestSpawnAnimation extends Animation
private int _currentHauntedColor = 0; private int _currentHauntedColor = 0;
private List<ArmorStand> _bats = Lists.newArrayList(); private List<ArmorStand> _bats = Lists.newArrayList();
private List<MaterialData> _flowers = new ArrayList<>();
private List<Item> _droppedFlowers = new ArrayList<>();
public ChestSpawnAnimation(Treasure treasure, Block block, List<BlockInfo> chestBlockInfo, Block openingCenter, double radialOffset, JavaPlugin javaPlugin) public ChestSpawnAnimation(Treasure treasure, Block block, List<BlockInfo> chestBlockInfo, Block openingCenter, double radialOffset, JavaPlugin javaPlugin)
{ {
@ -83,7 +98,9 @@ public class ChestSpawnAnimation extends Animation
_centerLocation = block.getLocation().clone().add(0.5, 0.5, 0.5); _centerLocation = block.getLocation().clone().add(0.5, 0.5, 0.5);
_chestBlockInfo = chestBlockInfo; _chestBlockInfo = chestBlockInfo;
_particleLocation = openingCenter.getLocation().add(0.5, 4, 0.5); _particleLocation = openingCenter.getLocation().clone().add(0.5, 4, 0.5);
_openingCenter = openingCenter.getLocation();
_particleDirection = UtilAlg.getTrajectory(_particleLocation, _centerLocation); _particleDirection = UtilAlg.getTrajectory(_particleLocation, _centerLocation);
_particleDirection.multiply(UtilMath.offset(_particleLocation, _centerLocation) / (double)ANIMATION_DURATION); _particleDirection.multiply(UtilMath.offset(_particleLocation, _centerLocation) / (double)ANIMATION_DURATION);
@ -103,6 +120,8 @@ public class ChestSpawnAnimation extends Animation
_radialOffset = radialOffset; _radialOffset = radialOffset;
_javaPlugin = javaPlugin; _javaPlugin = javaPlugin;
Bukkit.getPluginManager().registerEvents(this, javaPlugin);
} }
@Override @Override
@ -113,6 +132,17 @@ public class ChestSpawnAnimation extends Animation
//Move Particle Forwards //Move Particle Forwards
_particleLocation.add(_particleDirection); _particleLocation.add(_particleDirection);
Iterator<Item> droppedFlowersIterator = _droppedFlowers.iterator();
while (droppedFlowersIterator.hasNext())
{
Item flower = droppedFlowersIterator.next();
if (flower.getTicksLived() >= 20)
{
flower.remove();
droppedFlowersIterator.remove();
}
}
//Play Particles //Play Particles
if (getTreasure().getTreasureType() == TreasureType.OLD || getTreasure().getTreasureType() == TreasureType.LOVE_CHEST) if (getTreasure().getTreasureType() == TreasureType.OLD || getTreasure().getTreasureType() == TreasureType.LOVE_CHEST)
{ {
@ -246,10 +276,20 @@ public class ChestSpawnAnimation extends Animation
doBats(true, _centerLocation.clone().add(0, 6, 0), _bats); doBats(true, _centerLocation.clone().add(0, 6, 0), _bats);
} }
} }
else if (getTreasure().getTreasureType() == TreasureType.ST_PATRICKS) else if (getTreasure().getTreasureType() == TreasureType.SPRING)
{ {
Location location = _centerLocation.clone().add(0, 5, 0); if (getTicks() % 5 == 0)
{
if (_flowers.size() == 0)
generateFlowerList();
int r = UtilMath.random.nextInt(_flowers.size());
MaterialData materialData = _flowers.get(r);
Item flower = _openingCenter.getWorld().dropItem(_openingCenter.clone().add(0.5, 0, 0.5), ItemStackFactory.Instance.CreateStack(materialData.getMaterial(), materialData.getData(), 1, "Flower" + getTicks()));
Vector vel = new Vector(_openingCenter.getX() - _centerLocation.getX(), 0, _openingCenter.getZ() - _centerLocation.getZ());
UtilAction.velocity(flower, vel, 0.1, false, 0, 0.2 + 1 * 0.4, 1, false);
_droppedFlowers.add(flower);
}
} }
//Spawn Chest //Spawn Chest
@ -338,7 +378,12 @@ public class ChestSpawnAnimation extends Animation
@Override @Override
protected void onFinish() protected void onFinish()
{ {
HandlerList.unregisterAll(this);
for (Item item : _droppedFlowers)
{
item.remove();
}
_droppedFlowers.clear();
} }
private void doBats(boolean initial, Location center, List<ArmorStand> bats) private void doBats(boolean initial, Location center, List<ArmorStand> bats)
@ -372,4 +417,34 @@ public class ChestSpawnAnimation extends Animation
} }
} }
} }
private void generateFlowerList()
{
_flowers.add(MaterialData.of(Material.LONG_GRASS, (byte) 1));
_flowers.add(MaterialData.of(Material.LONG_GRASS, (byte) 2));
_flowers.add(MaterialData.of(Material.DEAD_BUSH, (byte) 0));
_flowers.add(MaterialData.of(Material.YELLOW_FLOWER, (byte) 0));
_flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 0));
_flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 1));
_flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 2));
_flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 3));
_flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 4));
_flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 5));
_flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 6));
_flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 7));
_flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 8));
_flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 0));
_flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 1));
_flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 2));
_flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 3));
_flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 4));
_flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 5));
}
@EventHandler
public void onPickup(PlayerPickupItemEvent event)
{
if (_droppedFlowers.contains(event.getItem()))
event.setCancelled(true);
}
} }

View File

@ -1,5 +1,6 @@
package mineplex.core.treasure.animation; package mineplex.core.treasure.animation;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@ -9,7 +10,9 @@ import org.bukkit.entity.Item;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.common.MaterialData;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilMath;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.BlockInfo;
import mineplex.core.treasure.Treasure; import mineplex.core.treasure.Treasure;
@ -20,6 +23,7 @@ public class TreasureRemoveAnimation extends Animation
private Random _random = new Random(); private Random _random = new Random();
private List<BlockInfo> _otherChests; private List<BlockInfo> _otherChests;
private int _count = 0; private int _count = 0;
private List<MaterialData> _flowers = new ArrayList<>();
public TreasureRemoveAnimation(Treasure treasure, List<BlockInfo> otherChests) public TreasureRemoveAnimation(Treasure treasure, List<BlockInfo> otherChests)
{ {
@ -42,6 +46,19 @@ public class TreasureRemoveAnimation extends Animation
dropItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_NUGGET, (byte) 0, 1, "DroppedNugget" + _count), info); dropItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_NUGGET, (byte) 0, 1, "DroppedNugget" + _count), info);
_count++; _count++;
} }
else if (getTreasure().getTreasureType() == TreasureType.SPRING)
{
// Drops random flower
if (_flowers.size() == 0)
generateFlowerList();
int r = UtilMath.random.nextInt(_flowers.size());
MaterialData materialData = _flowers.get(r);
dropItem(ItemStackFactory.Instance.CreateStack(materialData.getMaterial(), materialData.getData(), 1, "Flower" + _count), info);
_count++;
info.getBlock().setType(Material.AIR);
info.getBlock().setData((byte) 0);
}
} }
else else
{ {
@ -60,6 +77,29 @@ public class TreasureRemoveAnimation extends Animation
getTreasure().getTreasureManager().addItem(item); getTreasure().getTreasureManager().addItem(item);
} }
private void generateFlowerList()
{
_flowers.add(MaterialData.of(Material.LONG_GRASS, (byte) 1));
_flowers.add(MaterialData.of(Material.LONG_GRASS, (byte) 2));
_flowers.add(MaterialData.of(Material.DEAD_BUSH, (byte) 0));
_flowers.add(MaterialData.of(Material.YELLOW_FLOWER, (byte) 0));
_flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 0));
_flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 1));
_flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 2));
_flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 3));
_flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 4));
_flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 5));
_flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 6));
_flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 7));
_flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 8));
_flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 0));
_flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 1));
_flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 2));
_flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 3));
_flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 4));
_flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 5));
}
@Override @Override
protected void onFinish() protected void onFinish()
{ {

View File

@ -83,6 +83,32 @@ public class BuyChestButton implements IButton
return; return;
} }
} }
if (_chestType == TreasureType.ST_PATRICKS)
{
if (!new File("../../update/files/EnableStPatricksChest.dat").exists())
{
player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!"));
return;
}
if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player))
{
player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!"));
return;
}
}
if (_chestType == TreasureType.SPRING)
{
if (!new File("../../update/files/EnableSpringChest.dat").exists())
{
player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!"));
return;
}
if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player))
{
player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!"));
return;
}
}
if (_chestType == TreasureType.FREEDOM || _chestType == TreasureType.HAUNTED) if (_chestType == TreasureType.FREEDOM || _chestType == TreasureType.HAUNTED)
{ {
if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player)) if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player))

View File

@ -138,6 +138,7 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
int minestrikeCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.MINESTRIKE.getItemName()); int minestrikeCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.MINESTRIKE.getItemName());
int loveCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.LOVE_CHEST.getItemName()); int loveCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.LOVE_CHEST.getItemName());
int stpatricksCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.ST_PATRICKS.getItemName()); int stpatricksCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.ST_PATRICKS.getItemName());
int springCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.SPRING.getItemName());
boolean availableChristmas = false; boolean availableChristmas = false;
boolean availableFreedom = false; boolean availableFreedom = false;
@ -147,6 +148,7 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
boolean availableGingerbread = false; boolean availableGingerbread = false;
boolean availableLove = false; boolean availableLove = false;
boolean availableStPatricks = new File("../../update/files/EnableStPatricksChest.dat").exists(); boolean availableStPatricks = new File("../../update/files/EnableStPatricksChest.dat").exists();
boolean availableSpring = new File("../../update/files/EnableSpringChest.dat").exists();
List<String> shardLore = new ArrayList<>(); List<String> shardLore = new ArrayList<>();
shardLore.add(" "); shardLore.add(" ");
@ -427,12 +429,36 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
} }
else else
{ {
stpatricksLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + TreasureType.LOVE_CHEST.getPurchasePrice() + " Treasure Shards"); stpatricksLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + TreasureType.ST_PATRICKS.getPurchasePrice() + " Treasure Shards");
stpatricksLore.add(" "); stpatricksLore.add(" ");
stpatricksLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); stpatricksLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop");
} }
} }
List<String> springLore = Lists.newArrayList();
springLore.add(" ");
springLore.add(F.value("Spring Chests Owned", "" + springCount));
springLore.add(" ");
springLore.addAll(UtilText.splitLines(new String[]{C.cGray + "Spring is here! Find 6 limited edition Spring Cosmetics in the Spring Chest! Only available for a limited time. Guaranteed no Duplicate items!"}, LineFormat.LORE));
springLore.add(" ");
if (springCount > 0)
{
springLore.add(C.cGreen + "Click to Open!");
}
else
{
if (!availableSpring)
{
springLore.add(C.cRed + "This item is no longer available");
}
else
{
springLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + TreasureType.SPRING.getPurchasePrice() + " Treasure Shards");
springLore.add(" ");
springLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop");
}
}
ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false); ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false);
// Normal chests // Normal chests
@ -452,6 +478,7 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
ItemStack gingerbread = SkinData.GINGERBREAD.getSkull(C.cRedB + "Gingerbread" + C.cGreenB + " Treasure", gingerbreadLore); ItemStack gingerbread = SkinData.GINGERBREAD.getSkull(C.cRedB + "Gingerbread" + C.cGreenB + " Treasure", gingerbreadLore);
ItemStack lovechest = new ShopItem(Material.WOOL, (byte) 6, C.cRedB + "Love Chest", lovechestLore.toArray(new String[0]), 0, false, false); ItemStack lovechest = new ShopItem(Material.WOOL, (byte) 6, C.cRedB + "Love Chest", lovechestLore.toArray(new String[0]), 0, false, false);
ItemStack stpatricks = SkinData.LEPRECHAUN.getSkull(C.cGreenB + "St Patrick's Treasure", stpatricksLore); ItemStack stpatricks = SkinData.LEPRECHAUN.getSkull(C.cGreenB + "St Patrick's Treasure", stpatricksLore);
ItemStack spring = new ShopItem(Material.DOUBLE_PLANT, (byte) 4, C.cGreenB + "Spring Treasure", springLore.toArray(new String[0]), 1, false, false);
// Adds shard item // Adds shard item
addItem(49, shards); addItem(49, shards);
@ -475,6 +502,7 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
TreasurePageItem gingerbreadTreasureItem = new TreasurePageItem(gingerbread, gingerbreadCount, TreasureType.GINGERBREAD); TreasurePageItem gingerbreadTreasureItem = new TreasurePageItem(gingerbread, gingerbreadCount, TreasureType.GINGERBREAD);
TreasurePageItem loveChestItem = new TreasurePageItem(lovechest, loveCount, TreasureType.LOVE_CHEST); TreasurePageItem loveChestItem = new TreasurePageItem(lovechest, loveCount, TreasureType.LOVE_CHEST);
TreasurePageItem stPatricksItem = new TreasurePageItem(stpatricks, stpatricksCount, TreasureType.ST_PATRICKS); TreasurePageItem stPatricksItem = new TreasurePageItem(stpatricks, stpatricksCount, TreasureType.ST_PATRICKS);
TreasurePageItem springItem = new TreasurePageItem(spring, springCount, TreasureType.SPRING);
_normalTreasures.add(oldTreasureItem); _normalTreasures.add(oldTreasureItem);
_normalTreasures.add(ancientTreasureItem); _normalTreasures.add(ancientTreasureItem);
@ -483,6 +511,12 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
_normalTreasures.add(omegaTreasureItem); _normalTreasures.add(omegaTreasureItem);
_normalTreasures.add(minestrikeTreasureItem); _normalTreasures.add(minestrikeTreasureItem);
if (availableSpring)
_specialTreasures.add(springItem);
else
_seasonalTreasures.add(springItem);
if (availableStPatricks) if (availableStPatricks)
_specialTreasures.add(stPatricksItem); _specialTreasures.add(stPatricksItem);
else else

View File

@ -110,7 +110,7 @@ public class UtilGameProfile
} }
// Pattern to remove all non alphanumeric + underscore letters // Pattern to remove all non alphanumeric + underscore letters
private static final Pattern LEGAL_USERNAME = Pattern.compile("[^A-Za-z0-9_]"); private static final Pattern LEGAL_USERNAME = Pattern.compile("[^a-z0-9_]", Pattern.CASE_INSENSITIVE);
/** /**
* Convert a string to a legal username equivalent * Convert a string to a legal username equivalent

View File

@ -19,9 +19,9 @@ import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Egg; import org.bukkit.entity.Egg;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; 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;
@ -1005,9 +1005,11 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter
UtilTextTop.display(text, UtilServer.getPlayers()); UtilTextTop.display(text, UtilServer.getPlayers());
//Fix Entity Names //Fix Entity Names
for (Creature pet : _petManager.getPets()) for (Entity pet : _petManager.getPets())
{ {
DisguiseBase disguise = _disguiseManager.getDisguise(pet); if (pet instanceof LivingEntity)
{
DisguiseBase disguise = _disguiseManager.getDisguise((LivingEntity) pet);
if (disguise instanceof DisguiseWither) if (disguise instanceof DisguiseWither)
{ {
@ -1015,6 +1017,7 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter
disguise.resendMetadata(); disguise.resendMetadata();
} }
} }
}
for (Mount mount : _mountManager.getMounts()) for (Mount mount : _mountManager.getMounts())
{ {

View File

@ -4,13 +4,6 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.UUID; import java.util.UUID;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.HoverEvent.Action;
import net.md_5.bungee.api.chat.TextComponent;
import net.minecraft.server.v1_8_R3.EntityInsentient;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
@ -48,7 +41,6 @@ import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager; import mineplex.core.achievement.AchievementManager;
import mineplex.core.antispam.AntiSpamManager; import mineplex.core.antispam.AntiSpamManager;
import mineplex.core.aprilfools.AprilFoolsManager;
import mineplex.core.benefit.BenefitManager; import mineplex.core.benefit.BenefitManager;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.bonuses.BonusManager; import mineplex.core.bonuses.BonusManager;
@ -121,6 +113,7 @@ import mineplex.hub.commands.ForcefieldRadius;
import mineplex.hub.commands.GadgetToggle; import mineplex.hub.commands.GadgetToggle;
import mineplex.hub.commands.GameModeCommand; import mineplex.hub.commands.GameModeCommand;
import mineplex.hub.commands.NewsCommand; import mineplex.hub.commands.NewsCommand;
import mineplex.hub.modules.EasterEggHunt;
import mineplex.hub.modules.ForcefieldManager; import mineplex.hub.modules.ForcefieldManager;
import mineplex.hub.modules.HubVisibilityManager; import mineplex.hub.modules.HubVisibilityManager;
import mineplex.hub.modules.JumpManager; import mineplex.hub.modules.JumpManager;
@ -138,6 +131,12 @@ import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent;
import mineplex.minecraft.game.core.combat.DeathMessageType; import mineplex.minecraft.game.core.combat.DeathMessageType;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.condition.ConditionManager; import mineplex.minecraft.game.core.condition.ConditionManager;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.HoverEvent.Action;
import net.md_5.bungee.api.chat.TextComponent;
import net.minecraft.server.v1_8_R3.EntityInsentient;
import net.minecraft.server.v1_8_R3.EntityPlayer;
public class HubManager extends MiniClientPlugin<HubClient> implements IChatMessageFormatter public class HubManager extends MiniClientPlugin<HubClient> implements IChatMessageFormatter
{ {
@ -178,6 +177,8 @@ public class HubManager extends MiniClientPlugin<HubClient> implements IChatMess
private MavericksManager _mavericksManager; private MavericksManager _mavericksManager;
private final TwoFactorAuth _twofactor = Managers.require(TwoFactorAuth.class); private final TwoFactorAuth _twofactor = Managers.require(TwoFactorAuth.class);
private HologramManager _hologramManager;
private Location _spawn; private Location _spawn;
private final String _serverName; private final String _serverName;
@ -284,6 +285,10 @@ public class HubManager extends MiniClientPlugin<HubClient> implements IChatMess
new CommunityManager(plugin, _clientManager); new CommunityManager(plugin, _clientManager);
_hologramManager = hologramManager;
new EasterEggHunt(plugin, _clientManager);
ScoreboardManager scoreboardManager = new ScoreboardManager(plugin) ScoreboardManager scoreboardManager = new ScoreboardManager(plugin)
{ {
@Override @Override
@ -782,6 +787,11 @@ public class HubManager extends MiniClientPlugin<HubClient> implements IChatMess
return _disguiseManager; return _disguiseManager;
} }
public HologramManager getHologram()
{
return _hologramManager;
}
public GadgetManager GetGadget() public GadgetManager GetGadget()
{ {
return _gadgetManager; return _gadgetManager;

View File

@ -0,0 +1,28 @@
package mineplex.hub.commands;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.hub.modules.EasterEggHunt;
public class EggAddCommand extends CommandBase<EasterEggHunt>
{
public EggAddCommand(EasterEggHunt plugin)
{
super(plugin, Rank.ADMIN, "addegg");
}
@Override
public void Execute(Player caller, String[] args)
{
if (args.length < 1)
{
UtilPlayer.message(caller, F.main(Plugin.getName(), "Usage: /addegg <yyyy-[m]m-[d]d>"));
return;
}
Plugin.addEgg(caller, args[0]);
}
}

View File

@ -0,0 +1,390 @@
package mineplex.hub.modules;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.SkullType;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Skull;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import mineplex.core.Managers;
import mineplex.core.MiniDbClientPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.donation.DonationManager;
import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.HologramInteraction;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.HubManager;
import mineplex.hub.commands.EggAddCommand;
import mineplex.hub.modules.EasterEggHunt.EasterEggHunter;
import mineplex.serverdata.database.DBPool;
public class EasterEggHunt extends MiniDbClientPlugin<EasterEggHunter>
{
private static final int SHARD_REWARD = 500;
private static final String ITEM_REWARD = "Omega Chest";
private static final int EGGS_PER_DAY = 30;
private static final BlockFace[] BLOCK_FACES = {
BlockFace.NORTH,
BlockFace.EAST,
BlockFace.SOUTH,
BlockFace.WEST,
BlockFace.NORTH_EAST,
BlockFace.SOUTH_EAST,
BlockFace.SOUTH_WEST,
BlockFace.NORTH_WEST
};
private static final String[] EGG_SKINS = {
"KingCrazy_",
"Trajectories"
};
private final DonationManager _donationManager;
private final InventoryManager _inventoryManager;
private final List<EasterEgg> _possibleEggs;
public EasterEggHunt(JavaPlugin plugin, CoreClientManager clientManager)
{
super("Egg Hunt", plugin, clientManager);
_donationManager = Managers.get(DonationManager.class);
_inventoryManager = Managers.get(InventoryManager.class);
_possibleEggs = new ArrayList<>();
runAsync(() ->
{
final List<EasterEgg> fetch = new ArrayList<>();
loadEggs(fetch);
runSync(() ->
{
fetch.stream().peek(EasterEgg::setup).forEach(_possibleEggs::add);
});
});
addCommand(new EggAddCommand(this));
}
private String vecToStr(Vector vec)
{
return vec.getX() + "," + vec.getY() + "," + vec.getZ();
}
private Vector strToVec(String str)
{
String[] coords = str.split(",");
double x = Double.parseDouble(coords[0]);
double y = Double.parseDouble(coords[1]);
double z = Double.parseDouble(coords[2]);
return new Vector(x, y, z);
}
private void loadEggs(List<EasterEgg> eggs)
{
try (Connection c = DBPool.getAccount().getConnection())
{
ResultSet rs = c.prepareStatement("SELECT * FROM easterEggs;").executeQuery();
while (rs.next())
{
EasterEgg egg = new EasterEgg(rs.getInt("id"), strToVec(rs.getString("eggLocation")), rs.getDate("eggDate"));
eggs.add(egg);
}
}
catch (SQLException e)
{
e.printStackTrace();
}
}
private void addEggToInventory(int accountId, int eggId)
{
runAsync(() ->
{
try (Connection c = DBPool.getAccount().getConnection())
{
PreparedStatement ps = c.prepareStatement("INSERT INTO accountEggs (accountId, eggId) VALUES (?, ?);");
ps.setInt(1, accountId);
ps.setInt(2, eggId);
ps.execute();
}
catch (SQLException e)
{
e.printStackTrace();
}
});
}
@EventHandler
public void interactBlock(PlayerInteractEvent event)
{
if (event.getClickedBlock() == null)
{
return;
}
Player player = event.getPlayer();
for (EasterEgg egg : _possibleEggs)
{
if (egg.isMe(event.getClickedBlock()))
{
findEgg(player, egg.getId());
event.setCancelled(true);
break;
}
}
}
@EventHandler
public void refreshEggs(UpdateEvent event)
{
if (event.getType() == UpdateType.SEC)
{
LocalDate currentDate = LocalDate.now();
_possibleEggs.stream().filter(EasterEgg::isSpawned).filter(egg ->
{
LocalDate eggDate = egg.getDate().toLocalDate();
return eggDate.getDayOfYear() != currentDate.getDayOfYear();
}).forEach(egg ->
{
egg.despawn();
GetValues().forEach(hunter -> hunter.getEggs().remove(egg.getId()));
});
_possibleEggs.stream().filter(egg -> !egg.isSpawned()).filter(egg ->
{
LocalDate eggDate = egg.getDate().toLocalDate();
return eggDate.getDayOfYear() == currentDate.getDayOfYear();
}).forEach(EasterEgg::spawn);
}
}
public void addEgg(Player player, String date)
{
final Date parsed = Date.valueOf(date);
final Vector loc = player.getLocation().toVector();
runAsync(() ->
{
try (Connection c = DBPool.getAccount().getConnection())
{
PreparedStatement ps = c.prepareStatement("INSERT INTO easterEggs (eggLocation, eggDate) VALUES (?, ?);");
ps.setString(1, vecToStr(loc));
ps.setDate(2, parsed);
ps.execute();
PreparedStatement ret = c.prepareStatement("SELECT COUNT(id) FROM easterEggs WHERE eggDate=?;");
ret.setDate(1, parsed);
ResultSet rs = ret.executeQuery();
if (rs.next())
{
UtilPlayer.message(player, F.main(getName(), "There are " + rs.getInt(1) + " eggs saved for " + date + "!"));
}
}
catch (SQLException e)
{
e.printStackTrace();
}
});
}
private void findEgg(Player player, Integer eggId)
{
if (Get(player).getEggs().contains(eggId))
{
UtilPlayer.message(player, F.main(getName(), "You have already found this egg! There are " + F.count(EGGS_PER_DAY - Get(player).getEggs().size()) + " more eggs to find today!"));
return;
}
player.playSound(player.getLocation(), Sound.CAT_MEOW, 1, 0.7F);
Get(player).findEgg(eggId);
UtilPlayer.message(player, F.main(getName(), "Found " + F.count(Get(player).getEggs().size()) + "/" + F.count(EGGS_PER_DAY) + " Easter Eggs +" + F.currency(GlobalCurrency.TREASURE_SHARD, SHARD_REWARD) + "."));
_donationManager.rewardCurrencyUntilSuccess(GlobalCurrency.TREASURE_SHARD, player, "", SHARD_REWARD);
addEggToInventory(ClientManager.getAccountId(player), eggId);
if (Get(player).getEggs().size() == 1)
{
UtilPlayer.message(player, F.main(getName(), "There are " + F.count(EGGS_PER_DAY) + " hidden " + F.elem("Easter Eggs") + " to find through the lobby each day."));
UtilPlayer.message(player, F.main(getName(), "Each one is worth " + F.currency(GlobalCurrency.TREASURE_SHARD, SHARD_REWARD) + "."));
UtilPlayer.message(player, F.main(getName(), "If you find all " + F.count(EGGS_PER_DAY) + " you will receive an " + C.cAqua + "Omega Chest for that day!"));
}
else if (Get(player).getEggs().size() == EGGS_PER_DAY)
{
UtilPlayer.message(player, F.main(getName(), "You have found all the eggs available today!"));
_inventoryManager.addItemToInventory(success ->
{
if (success)
{
UtilPlayer.message(player, F.main(getName(), "+1 " + C.cAqua + ITEM_REWARD + C.mBody + "!"));
}
else
{
UtilPlayer.message(player, F.main(getName(), "Oh no! An error occurred while trying to give you your chest! Go find a staff member ASAP!"));
}
}, player, ITEM_REWARD, 1);
}
}
public static class EasterEggHunter
{
private List<Integer> _found;
public EasterEggHunter()
{
this(new ArrayList<>());
}
public EasterEggHunter(List<Integer> foundEggs)
{
_found = foundEggs;
}
public List<Integer> getEggs()
{
return _found;
}
public void findEgg(Integer id)
{
_found.add(id);
}
}
public static class EasterEgg
{
private final Integer _id;
private final Vector _loc;
private final Date _date;
private boolean _spawned;
private Location _spawn;
private Hologram _holo;
public EasterEgg(Integer id, Vector loc, Date date)
{
_id = id;
_loc = loc;
_date = date;
_spawned = false;
}
public Integer getId()
{
return _id;
}
public Date getDate()
{
return _date;
}
public boolean isSpawned()
{
return _spawned;
}
public boolean isMe(Block block)
{
return isSpawned() && UtilWorld.locToStr(block.getLocation()).equals(UtilWorld.locToStr(_spawn.getBlock().getLocation()));
}
public void setup()
{
_spawn = _loc.toLocation(Managers.get(HubManager.class).GetSpawn().getWorld());
_spawned = false;
_holo = new Hologram(Managers.get(HubManager.class).getHologram(), _spawn.clone().add(0, 1.5, 0), C.cDPurple + C.Scramble + "ABC " + C.cPurpleB + "Easter Egg Hunt" + C.cDPurple + C.Scramble + " ABC");
_holo.setViewDistance(4);
_holo.setInteraction(new HologramInteraction()
{
@Override
public void onClick(Player player, ClickType clickType)
{
Managers.get(EasterEggHunt.class).findEgg(player, getId());
}
});
_holo.stop();
}
@SuppressWarnings("deprecation")
public void spawn()
{
if (isSpawned())
{
return;
}
_spawn.getBlock().setType(Material.SKULL);
_spawn.getBlock().setData((byte) 1);
Skull skull = (Skull) _spawn.getBlock().getState();
skull.setSkullType(SkullType.PLAYER);
skull.setOwner(EGG_SKINS[UtilMath.r(EGG_SKINS.length)]);
skull.setRotation(BLOCK_FACES[UtilMath.r(BLOCK_FACES.length)]);
skull.update();
_holo.start();
_spawned = true;
}
public void despawn()
{
if (isSpawned())
{
_spawn.getBlock().setType(Material.AIR);
_spawned = false;
_holo.stop();
}
}
}
@Override
public String getQuery(int accountId, String uuid, String name)
{
return "SELECT ae.eggId, ee.eggDate FROM accountEggs AS ae INNER JOIN easterEggs AS ee ON ae.eggId=ee.id WHERE ae.accountId=" + accountId + ";";
}
@Override
public void processLoginResultSet(String playerName, UUID uuid, int accountId, ResultSet resultSet) throws SQLException
{
List<Integer> found = new ArrayList<>();
while (resultSet.next())
{
if (resultSet.getDate("eggDate").toLocalDate().getDayOfYear() == LocalDate.now().getDayOfYear())
{
found.add(resultSet.getInt("eggId"));
}
}
Set(uuid, new EasterEggHunter(found));
}
@Override
protected EasterEggHunter addPlayer(UUID uuid)
{
return new EasterEggHunter();
}
}

View File

@ -3,6 +3,14 @@ package mineplex.hub.modules;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
@ -26,13 +34,6 @@ import mineplex.hub.HubManager;
import mineplex.hub.HubRepository; import mineplex.hub.HubRepository;
import mineplex.hub.HubType; import mineplex.hub.HubType;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
public class NewsManager extends MiniPlugin public class NewsManager extends MiniPlugin
{ {
public HubManager Manager; public HubManager Manager;
@ -347,9 +348,11 @@ public class NewsManager extends MiniPlugin
UtilTextTop.display(text, UtilServer.getPlayers()); UtilTextTop.display(text, UtilServer.getPlayers());
//Fix Entity Names //Fix Entity Names
for (Creature pet : Manager.getPetManager().getPets()) for (Entity pet : Manager.getPetManager().getPets())
{ {
DisguiseBase disguise = Manager.GetDisguise().getDisguise(pet); if (pet instanceof LivingEntity)
{
DisguiseBase disguise = Manager.GetDisguise().getDisguise((LivingEntity) pet);
if (disguise instanceof DisguiseWither) if (disguise instanceof DisguiseWither)
{ {
@ -357,6 +360,7 @@ public class NewsManager extends MiniPlugin
disguise.resendMetadata(); disguise.resendMetadata();
} }
} }
}
for (Mount mount : Manager.GetMount().getMounts()) for (Mount mount : Manager.GetMount().getMounts())
{ {

View File

@ -747,7 +747,7 @@ public class ServerManager extends MiniPlugin implements BrawlShopProvider
public ServerNpcShop getBetaShop() public ServerNpcShop getBetaShop()
{ {
return _serverNpcShopMap.get("Skyfall BETA"); return _serverNpcShopMap.get("Skyfall");
} }
public ServerNpcShop getUHCShop() public ServerNpcShop getUHCShop()

View File

@ -3,20 +3,40 @@ package mineplex.hub.server.ui;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import mineplex.core.boosters.Booster;
import mineplex.core.shop.item.IButton;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.boosters.Booster;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import mineplex.hub.server.ServerManager; import mineplex.hub.server.ServerManager;
import mineplex.hub.server.ui.button.*; import mineplex.hub.server.ui.button.SelectBETAButton;
import mineplex.hub.server.ui.button.SelectBHButton;
import mineplex.hub.server.ui.button.SelectBLDButton;
import mineplex.hub.server.ui.button.SelectBRButton;
import mineplex.hub.server.ui.button.SelectBawkButton;
import mineplex.hub.server.ui.button.SelectCLANSButton;
import mineplex.hub.server.ui.button.SelectCSButton;
import mineplex.hub.server.ui.button.SelectCTFButton;
import mineplex.hub.server.ui.button.SelectDMTButton;
import mineplex.hub.server.ui.button.SelectDOMButton;
import mineplex.hub.server.ui.button.SelectFEATButton;
import mineplex.hub.server.ui.button.SelectMINButton;
import mineplex.hub.server.ui.button.SelectMSButton;
import mineplex.hub.server.ui.button.SelectPLAYERButton;
import mineplex.hub.server.ui.button.SelectSBButton;
import mineplex.hub.server.ui.button.SelectSGButton;
import mineplex.hub.server.ui.button.SelectSKYButton;
import mineplex.hub.server.ui.button.SelectSSMButton;
import mineplex.hub.server.ui.button.SelectTDMButton;
import mineplex.hub.server.ui.button.SelectUHCButton;
import mineplex.hub.server.ui.button.SelectWIZButton;
public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop> public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
{ {
@ -94,13 +114,13 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
C.Reset + "Win! Fight! Send enemies flying in Skywars!", C.Reset + "Win! Fight! Send enemies flying in Skywars!",
}, new String[] {"SKY", "SKY2"}, "Skywars", new SelectSKYButton(this)); }, new String[] {"SKY", "SKY2"}, "Skywars", new SelectSKYButton(this));
add(15, Material.GOLDEN_APPLE, C.cYellowB + "UHC " + C.cGray + "Ultra Hardcore Mode", new String[] add(15, Material.GOLDEN_APPLE, (byte) 0, C.cYellowB + "UHC " + C.cGray + "Ultra Hardcore Mode", new String[]
{ {
C.Reset + "", C.Reset + "",
C.Reset + "Extremely hard team-based survival ", C.Reset + "Extremely hard team-based survival ",
C.Reset + "Gather materials and fight your way", C.Reset + "Gather materials and fight your way",
C.Reset + "to become the last team standing!", C.Reset + "to become the last team standing!",
}, "UHC", "UHC", new SelectUHCButton(this)); }, new String[] {"UHC", "UHC2", "UHCS", "UHCS2"}, "UHC", new SelectUHCButton(this));
add(17, Material.BLAZE_ROD, C.cYellowB + "Wizards " + C.cGray + "Last Man Standing", new String[] add(17, Material.BLAZE_ROD, C.cYellowB + "Wizards " + C.cGray + "Last Man Standing", new String[]
{ {
@ -197,15 +217,14 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
C.Reset + "and raid others!", C.Reset + "and raid others!",
}, "Clans", null, new SelectCLANSButton(this)); }, "Clans", null, new SelectCLANSButton(this));
add(41, Material.BREWING_STAND_ITEM, C.cYellowB + "Skyfall " + C.cGray + "Elytra Game", new String[] add(41, Material.DIAMOND_BOOTS, (byte)0, C.cYellowB + "Skyfall " + C.cGray + "Elytra Game", new String[]
{ {
(_extraValue ? C.cAquaB : C.cWhiteB) + "BETA GAME",
C.Reset + "", C.Reset + "",
C.Reset + "1.9 Game, 1.8 PVP", C.Reset + "1.9 Game, 1.8 PVP",
C.Reset + "Fly through sky islands,", C.Reset + "Fly through sky islands,",
C.Reset + "collect gear and defeat", C.Reset + "collect gear and defeat",
C.Reset + "all enemies.", C.Reset + "all enemies.",
}, "BETA", "Beta_Games", new SelectBETAButton(this)); }, new String[]{"SF","SF2"}, "Beta_Games", new SelectBETAButton(this));
} }
private void add(int slot, Material material, String title, String[] lore, String serverTag, String boosterGroup, IButton button) private void add(int slot, Material material, String title, String[] lore, String serverTag, String boosterGroup, IButton button)

View File

@ -36,6 +36,9 @@ public class ServerNpcShop extends ShopBase<ServerManager>
case "UHC": case "UHC":
return new UHCServerTypePage(getPlugin(), this, getClientManager(), getDonationManager(), player); return new UHCServerTypePage(getPlugin(), this, getClientManager(), getDonationManager(), player);
case "SF":
return new SkyfallServerTypePage(getPlugin(), this, getClientManager(), getDonationManager(), player);
default: default:
return new ServerNpcPage(getPlugin(), this, getClientManager(), getDonationManager(), _serverGroup.getServerNpcName(), player, _serverGroup.getPrefix()); return new ServerNpcPage(getPlugin(), this, getClientManager(), getDonationManager(), _serverGroup.getServerNpcName(), player, _serverGroup.getPrefix());
} }

View File

@ -0,0 +1,48 @@
package mineplex.hub.server.ui;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.hub.server.ServerManager;
public class SkyfallServerTypePage extends ShopPageBase<ServerManager, ServerNpcShop>
{
public SkyfallServerTypePage(ServerManager plugin, ServerNpcShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player)
{
super(plugin, shop, clientManager, donationManager, "Skyfall", player, 27);
buildPage();
}
@Override
protected void buildPage()
{
setItem(12, new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3).setTitle(C.Reset + C.cYellow + "Skyfall Solo")
.addLore(new String[]
{
C.Reset + "",
C.Reset + C.cGreen + "Click to Play",
}).build());
setItem(14, new ItemBuilder(Material.SKULL_ITEM, 2, (byte) 3).setTitle(C.Reset + C.cYellow + "Skyfall Teams")
.addLore(new String[]
{
C.Reset + "",
C.Reset + C.cGreen + "Click to Play"
}).build());
getButtonMap().put(12, (player, __) -> getShop().openPageForPlayer(player, new ServerNpcPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Skyfall Solo", player, "SF")));
getButtonMap().put(14, (player, __) -> getShop().openPageForPlayer(player, new ServerNpcPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Skyfall Teams", player, "SF2")));
}
public void Update()
{
getButtonMap().clear();
buildPage();
}
}

View File

@ -92,12 +92,12 @@ public class StaffServer extends JavaPlugin
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf1b629c-cc55-4eb4-be9e-3ca86dfc7b9d"), "mannalou")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf1b629c-cc55-4eb4-be9e-3ca86dfc7b9d"), "mannalou"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("adaa7613-6683-400f-baf8-7272c04b2cb4"), "Tmmy")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("adaa7613-6683-400f-baf8-7272c04b2cb4"), "Tmmy"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("231fb752-9556-489b-8428-f47c7598e061"), "Nuclear_Poptart")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("492ff708-fe76-4c5a-b9ed-a747b5fa20a0"), "cherdy"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("492ff708-fe76-4c5a-b9ed-a747b5fa20a0"), "Cherdy8s"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("6edf17d5-6bb2-4ed9-92e9-bed8e96fff68"), "BlueBeetleHD")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("6edf17d5-6bb2-4ed9-92e9-bed8e96fff68"), "BlueBeetleHD"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("a47a4d04-9f51-44ba-9d35-8de6053e9289"), "AlexTheCoder")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("a47a4d04-9f51-44ba-9d35-8de6053e9289"), "AlexTheCoder"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("63ad2db3-7c62-4a10-ac58-d267973190ce"), "Crumplex")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("63ad2db3-7c62-4a10-ac58-d267973190ce"), "Crumplex"));
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("a47a4d04-9f51-44ba-9d35-8de6053e9289"), "AlexTheCoder"));
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("cf1b629c-cc55-4eb4-be9e-3ca86dfc7b9d"), "mannalou")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("cf1b629c-cc55-4eb4-be9e-3ca86dfc7b9d"), "mannalou"));
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20"));
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("6edf17d5-6bb2-4ed9-92e9-bed8e96fff68"), "BlueBeetleHD")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("6edf17d5-6bb2-4ed9-92e9-bed8e96fff68"), "BlueBeetleHD"));

View File

@ -167,6 +167,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
int minestrikeChestsReceived = 0; int minestrikeChestsReceived = 0;
int loveChestsReceived = 0; int loveChestsReceived = 0;
int stPatricksChestReceived = 0; int stPatricksChestReceived = 0;
int springChestsReceived = 0;
for (CoinTransactionToken transaction : donor.getCoinTransactions()) for (CoinTransactionToken transaction : donor.getCoinTransactions())
{ {
@ -330,6 +331,16 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
stPatricksChestReceived += 1; stPatricksChestReceived += 1;
} }
} }
if (transaction.SalesPackageName.startsWith("Spring Chest"))
{
if (transaction.Coins == 0 && transaction.Gems == 0)
{
if (transaction.SalesPackageName.split(" ").length == 3)
springChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
else if (transaction.SalesPackageName.split(" ").length == 2)
springChestsReceived += 1;
}
}
if (transaction.SalesPackageName.startsWith("Valentines Gift")) if (transaction.SalesPackageName.startsWith("Valentines Gift"))
{ {
if (transaction.Coins == 0 && transaction.Gems == 0) if (transaction.Coins == 0 && transaction.Gems == 0)
@ -403,6 +414,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
caller.sendMessage(C.cBlue + "Gingerbread Chests Received: " + C.cYellow + gingerbreadChestsReceived + " " + C.cBlue + "Minestrike Chests Received: " + C.cYellow + minestrikeChestsReceived); caller.sendMessage(C.cBlue + "Gingerbread Chests Received: " + C.cYellow + gingerbreadChestsReceived + " " + C.cBlue + "Minestrike Chests Received: " + C.cYellow + minestrikeChestsReceived);
caller.sendMessage(C.cBlue + "Love Chests Received: " + C.cYellow + loveChestsReceived); caller.sendMessage(C.cBlue + "Love Chests Received: " + C.cYellow + loveChestsReceived);
caller.sendMessage(C.cBlue + "St Patrick's Chests Received: " + C.cYellow + stPatricksChestReceived); caller.sendMessage(C.cBlue + "St Patrick's Chests Received: " + C.cYellow + stPatricksChestReceived);
caller.sendMessage(C.cBlue + "Spring Chests Received: " + C.cYellow + springChestsReceived);
caller.sendMessage(C.cBlue + "Game Amplifiers Received: " + C.cYellow + boostersReceived); caller.sendMessage(C.cBlue + "Game Amplifiers Received: " + C.cYellow + boostersReceived);
caller.sendMessage(C.cBlue + "Rune Amplifiers (20 min/60 min) Received: " + C.cYellow + runeAmplifier20 + "/" + runeAmplifier60); caller.sendMessage(C.cBlue + "Rune Amplifiers (20 min/60 min) Received: " + C.cYellow + runeAmplifier20 + "/" + runeAmplifier60);
caller.sendMessage(C.cBlue + "Clan Banner Usage: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Usage") + " " + C.cBlue + "Clan Banner Editor: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Editor")); caller.sendMessage(C.cBlue + "Clan Banner Usage: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Usage") + " " + C.cBlue + "Clan Banner Editor: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Editor"));

View File

@ -39,6 +39,7 @@ import mineplex.staffServer.salespackage.salespackages.Pet;
import mineplex.staffServer.salespackage.salespackages.PowerPlayClub; import mineplex.staffServer.salespackage.salespackages.PowerPlayClub;
import mineplex.staffServer.salespackage.salespackages.RuneAmplifier; import mineplex.staffServer.salespackage.salespackages.RuneAmplifier;
import mineplex.staffServer.salespackage.salespackages.SalesPackageBase; import mineplex.staffServer.salespackage.salespackages.SalesPackageBase;
import mineplex.staffServer.salespackage.salespackages.SpringChest;
import mineplex.staffServer.salespackage.salespackages.StPatricksChest; import mineplex.staffServer.salespackage.salespackages.StPatricksChest;
import mineplex.staffServer.salespackage.salespackages.ThankfulChest; import mineplex.staffServer.salespackage.salespackages.ThankfulChest;
import mineplex.staffServer.salespackage.salespackages.TrickOrTreatChest; import mineplex.staffServer.salespackage.salespackages.TrickOrTreatChest;
@ -102,6 +103,7 @@ public class SalesPackageManager extends MiniPlugin
AddSalesPackage(new MinestrikeChest(this)); AddSalesPackage(new MinestrikeChest(this));
AddSalesPackage(new LoveChest(this)); AddSalesPackage(new LoveChest(this));
AddSalesPackage(new StPatricksChest(this)); AddSalesPackage(new StPatricksChest(this));
AddSalesPackage(new SpringChest(this));
AddSalesPackage(new TrickOrTreatChest(this)); AddSalesPackage(new TrickOrTreatChest(this));
AddSalesPackage(new ThankfulChest(this)); AddSalesPackage(new ThankfulChest(this));
@ -173,7 +175,8 @@ public class SalesPackageManager extends MiniPlugin
coinBuilder = coinBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); coinBuilder = coinBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray");
} }
else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest || salesPackage instanceof IlluminatedChest || salesPackage instanceof FreedomChest || salesPackage instanceof HauntedChest || salesPackage instanceof TrickOrTreatChest else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest || salesPackage instanceof IlluminatedChest || salesPackage instanceof FreedomChest || salesPackage instanceof HauntedChest || salesPackage instanceof TrickOrTreatChest
|| salesPackage instanceof ThankfulChest || salesPackage instanceof GingerbreadChest || salesPackage instanceof MinestrikeChest || salesPackage instanceof LoveChest || salesPackage instanceof StPatricksChest) || salesPackage instanceof ThankfulChest || salesPackage instanceof GingerbreadChest || salesPackage instanceof MinestrikeChest || salesPackage instanceof LoveChest || salesPackage instanceof StPatricksChest
|| salesPackage instanceof SpringChest)
{ {
chestBuilder = chestBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); chestBuilder = chestBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray");
} }

View File

@ -0,0 +1,21 @@
package mineplex.staffServer.salespackage.salespackages;
import org.bukkit.entity.Player;
import mineplex.staffServer.salespackage.SalesPackageManager;
public class SpringChest extends SalesPackageBase
{
public SpringChest(SalesPackageManager manager)
{
super(manager, "1 Spring Chest");
}
public void displayToAgent(Player agent, String playerName)
{
addButton(agent, "/sales item " + playerName + " 1 Item Spring Chest", "Give 1 Spring Chest.");
agent.sendMessage(" ");
addBackButton(agent, playerName);
}
}

View File

@ -7,7 +7,10 @@ import mineplex.core.aprilfools.AprilFoolsManager;
import net.minecraft.server.v1_8_R3.MinecraftServer; import net.minecraft.server.v1_8_R3.MinecraftServer;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.ServicePriority;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.spigotmc.SpigotConfig; import org.spigotmc.SpigotConfig;
@ -19,6 +22,7 @@ import mineplex.core.TwitchIntegrationFix;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager; import mineplex.core.achievement.AchievementManager;
import mineplex.core.antihack.AntiHack; import mineplex.core.antihack.AntiHack;
import mineplex.core.antihack.RelationProvider;
import mineplex.core.antihack.logging.AntihackLogger; import mineplex.core.antihack.logging.AntihackLogger;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.blood.Blood; import mineplex.core.blood.Blood;
@ -80,6 +84,7 @@ import mineplex.minecraft.game.core.combat.CombatManager;
import mineplex.minecraft.game.core.damage.DamageManager; import mineplex.minecraft.game.core.damage.DamageManager;
import nautilus.game.arcade.anticheatmetadata.GameInfoMetadata; import nautilus.game.arcade.anticheatmetadata.GameInfoMetadata;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameServerConfig; import nautilus.game.arcade.game.GameServerConfig;
import static mineplex.core.Managers.require; import static mineplex.core.Managers.require;
@ -97,6 +102,26 @@ public class Arcade extends JavaPlugin
@Override @Override
public void onEnable() public void onEnable()
{ {
getServer().getServicesManager().register(RelationProvider.class, new RelationProvider()
{
@Override
public boolean canDamage(Player player, Entity target)
{
if (target instanceof Player)
{
return _gameManager.canHurt(player, (Player) target);
}
else if (target instanceof LivingEntity)
{
return _gameManager.GetGame() != null && _gameManager.GetGame().GetState() == Game.GameState.Live;
}
else
{
return false;
}
}
}, this, ServicePriority.Normal);
Bukkit.setSpawnRadius(0); Bukkit.setSpawnRadius(0);
//Delete Old Games Folders //Delete Old Games Folders
DeleteFolders(); DeleteFolders();

View File

@ -7,9 +7,8 @@ import mineplex.core.Managers;
import mineplex.core.command.CommandBase; import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.gadget.event.TauntCommandEvent; import mineplex.core.gadget.event.TauntCommandEvent;
import mineplex.core.gadget.gadgets.taunts.GameType; import mineplex.core.game.GameDisplay;
import mineplex.minecraft.game.core.combat.CombatManager; import mineplex.minecraft.game.core.combat.CombatManager;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
@ -29,21 +28,16 @@ public class TauntCommand extends CommandBase<ArcadeManager>
@Override @Override
public void Execute(Player player, String[] args) public void Execute(Player player, String[] args)
{ {
boolean pvp = false;
CombatManager combatManager = Managers.get(CombatManager.class); CombatManager combatManager = Managers.get(CombatManager.class);
if (combatManager != null)
{
pvp = UtilTime.elapsed(combatManager.Get(player).GetLastCombatEngaged(), 5000 * 60);
}
Game game = _arcadeManager.GetGame(); Game game = _arcadeManager.GetGame();
GameType gameType = GameType.NONE; GameDisplay gameDisplay = null;
if (game != null) if (game != null)
{ {
gameType = GameType.valueOf(game.GetType().toString().toUpperCase()); gameDisplay = game.GetType().getDisplay();
} }
TauntCommandEvent event = new TauntCommandEvent(player, _arcadeManager.isGameInProgress(), TauntCommandEvent event = new TauntCommandEvent(player, _arcadeManager.isGameInProgress(),
_arcadeManager.GetGame().IsAlive(player), UtilPlayer.isSpectator(player), combatManager.Get(player).GetLastCombatEngaged(), _arcadeManager.GetGame().IsAlive(player), UtilPlayer.isSpectator(player), combatManager.Get(player).GetLastCombatEngaged(),
gameType); gameDisplay);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
} }

View File

@ -13,9 +13,9 @@ import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import mineplex.core.lifetimes.Lifetimed; import net.minecraft.server.v1_8_R3.EntityItem;
import mineplex.core.lifetimes.ListenerComponent; import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
import mineplex.core.lifetimes.PhasedLifetime;
import org.apache.commons.lang3.tuple.Triple; import org.apache.commons.lang3.tuple.Triple;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -33,7 +33,6 @@ 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.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.ItemSpawnEvent;
@ -52,6 +51,8 @@ import com.mojang.authlib.GameProfile;
import mineplex.core.Managers; import mineplex.core.Managers;
import mineplex.core.antihack.AntiHack; import mineplex.core.antihack.AntiHack;
import mineplex.core.arcadeevents.CoreGameStartEvent;
import mineplex.core.arcadeevents.CoreGameStopEvent;
import mineplex.core.command.CommandCenter; import mineplex.core.command.CommandCenter;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
@ -68,8 +69,10 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.elo.EloPlayer; import mineplex.core.elo.EloPlayer;
import mineplex.core.elo.EloTeam; import mineplex.core.elo.EloTeam;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.lifetimes.Lifetimed;
import mineplex.core.lifetimes.ListenerComponent;
import mineplex.core.lifetimes.PhasedLifetime;
import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketInfo; import mineplex.core.packethandler.PacketInfo;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -91,7 +94,6 @@ import nautilus.game.arcade.game.games.draw.Draw;
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders; import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
import nautilus.game.arcade.game.modules.AntiExpOrbModule; import nautilus.game.arcade.game.modules.AntiExpOrbModule;
import nautilus.game.arcade.game.modules.Module; import nautilus.game.arcade.game.modules.Module;
import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.kit.ChampionsKit; import nautilus.game.arcade.kit.ChampionsKit;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
@ -112,8 +114,6 @@ import nautilus.game.arcade.stats.StatTracker;
import nautilus.game.arcade.stats.WinStatTracker; import nautilus.game.arcade.stats.WinStatTracker;
import nautilus.game.arcade.wineffect.WinEffectManager; import nautilus.game.arcade.wineffect.WinEffectManager;
import nautilus.game.arcade.world.WorldData; import nautilus.game.arcade.world.WorldData;
import net.minecraft.server.v1_8_R3.EntityItem;
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
public abstract class Game extends ListenerComponent implements Lifetimed public abstract class Game extends ListenerComponent implements Lifetimed
{ {
@ -750,6 +750,17 @@ public abstract class Game extends ListenerComponent implements Lifetimed
UtilServer.getServer().getPluginManager().callEvent(stateEvent); UtilServer.getServer().getPluginManager().callEvent(stateEvent);
System.out.println(GetName() + " state set to " + state.toString()); System.out.println(GetName() + " state set to " + state.toString());
if (state.equals(GameState.Prepare))
{
CoreGameStartEvent coreGameStartEvent = new CoreGameStartEvent(GetType().getDisplay());
UtilServer.getServer().getPluginManager().callEvent(coreGameStartEvent);
}
else if (state.equals(GameState.End))
{
CoreGameStopEvent coreGameStopEvent = new CoreGameStopEvent(GetType().getDisplay());
UtilServer.getServer().getPluginManager().callEvent(coreGameStopEvent);
}
} }
public void SetStateTime(long time) public void SetStateTime(long time)

View File

@ -5,6 +5,8 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import net.minecraft.server.v1_8_R3.EntityArrow;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -17,9 +19,15 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ProjectileHitEvent;
import com.mineplex.anticheat.checks.move.Glide;
import com.mineplex.anticheat.checks.move.HeadRoll;
import com.mineplex.anticheat.checks.move.Speed;
import mineplex.core.Managers;
import mineplex.core.antihack.AntiHack;
import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
@ -27,17 +35,18 @@ import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser; import mineplex.core.projectile.ProjectileUser;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.runner.kits.*; import nautilus.game.arcade.game.games.runner.kits.KitArcher;
import nautilus.game.arcade.game.games.runner.kits.KitFrosty;
import nautilus.game.arcade.game.games.runner.kits.KitLeaper;
import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.DistanceTraveledStatTracker; import nautilus.game.arcade.stats.DistanceTraveledStatTracker;
import net.minecraft.server.v1_8_R3.EntityArrow;
public class Runner extends SoloGame implements IThrown public class Runner extends SoloGame implements IThrown
{ {
private HashMap<Block, Long> _blocks = new HashMap<Block, Long>(); private HashMap<Block, Long> _blocks = new HashMap<Block, Long>();
@ -85,6 +94,11 @@ public class Runner extends SoloGame implements IThrown
.setGiveCompassToSpecs(true) .setGiveCompassToSpecs(true)
.setGiveCompassToAlive(false) .setGiveCompassToAlive(false)
.register(this); .register(this);
AntiHack antiHack = Managers.get(AntiHack.class);
antiHack.addIgnoredCheck(Speed.class);
antiHack.addIgnoredCheck(Glide.class);
antiHack.addIgnoredCheck(HeadRoll.class);
} }
@EventHandler @EventHandler

Some files were not shown because too many files have changed in this diff Show More