aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/los/numeros/EPHS/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/los/numeros/EPHS/modules')
-rw-r--r--src/main/java/los/numeros/EPHS/modules/MainModule.java70
1 files changed, 40 insertions, 30 deletions
diff --git a/src/main/java/los/numeros/EPHS/modules/MainModule.java b/src/main/java/los/numeros/EPHS/modules/MainModule.java
index ea7a923..c0715c3 100644
--- a/src/main/java/los/numeros/EPHS/modules/MainModule.java
+++ b/src/main/java/los/numeros/EPHS/modules/MainModule.java
@@ -7,31 +7,37 @@ import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
+import net.minecraft.scoreboard.Scoreboard;
+import net.minecraft.scoreboard.Team;
+import net.minecraft.scoreboard.AbstractTeam.VisibilityRule;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
-import net.minecraft.server.world.ServerWorld;
+import net.minecraft.util.Formatting;
import net.minecraft.world.GameMode;
import los.numeros.EPHS.Constants;
public class MainModule implements Module {
- ServerPlayerEntity[] diggers, hidders, players;
+ ServerPlayerEntity[] seekers, hiders, players;
ServerCommandSource source;
+ Scoreboard scoreboard;
+ Team seekersTeam, hidersTeam;
- public MainModule(ServerPlayerEntity[] diggers, ServerPlayerEntity[] hidders, ServerPlayerEntity[] players, ServerCommandSource source) {
- this.diggers = diggers;
- this.hidders = hidders;
+ public MainModule(ServerPlayerEntity[] seekers, ServerPlayerEntity[] hiders, ServerPlayerEntity[] players, ServerCommandSource source) {
+ this.seekers = seekers;
+ this.hiders = hiders;
this.players = players;
this.source = source;
}
- public void giveSeekerItems(ServerPlayerEntity[] diggers) {
- for (ServerPlayerEntity p : diggers) {
+ public void giveSeekerItems(ServerPlayerEntity[] seekers) {
+ for (ServerPlayerEntity p : seekers) {
// give armor
GiveItem.givePlayerItem(p, "diamond_helmet", GiveItem.ARMOR_HEAD);
GiveItem.givePlayerItem(p, "diamond_leggings", GiveItem.ARMOR_LEGS);
GiveItem.givePlayerItem(p, "diamond_chestplate", GiveItem.ARMOR_CHEST);
GiveItem.givePlayerItem(p, "diamond_boots", GiveItem.ARMOR_BOOTS);
+ // get diamond sword and put sarp 1 on it for seeker
ItemStack sword = GiveItem.getItem("iron_sword");
sword.addEnchantment(Enchantments.SHARPNESS, 1);
@@ -41,26 +47,18 @@ public class MainModule implements Module {
sword.setTag(sTag);
p.equip(0, sword);
+ // give seeker ender pearl x32
+ GiveItem.giveMultipleItem(p, "ender_pearl", null, 32);
+
// teleport to the seeker box
p.teleport(Constants.seekerSpawnX, Constants.seekerSpawnY, Constants.seekerSpawnZ);
}
}
public void giveHidersItems(ServerPlayerEntity[] hiders) {
- // get pick with silk touch
- ItemStack pickaxe = GiveItem.getItem("diamond_pickaxe");
- pickaxe.addEnchantment(Enchantments.SILK_TOUCH, 1);
-
- // put unbreakable attribute into NBT tag
- NbtCompound pTag = pickaxe.getTag();
- pTag.putBoolean("Unbreakable", true);
- pickaxe.setTag(pTag);
-
for (ServerPlayerEntity p : hiders) {
- // equip picaxe on each player
- p.equip(0, pickaxe);
- // give stone x10
- GiveItem.giveMultipleItem(p, "minecraft:stone", null, 10);
+ // Give hiders ender pearls x16
+ GiveItem.giveMultipleItem(p, "ender_pearl", null, 16);
p.teleport(Constants.hidersSpawnX, Constants.hidersSpawnY, Constants.hidersSpawnZ);
}
}
@@ -68,26 +66,33 @@ public class MainModule implements Module {
@Override
public int init()
{
+ //set up seeker team
+ scoreboard = players[0].getScoreboard();
+ seekersTeam = scoreboard.addTeam("Seeksers");
+ seekersTeam.setColor(Formatting.GOLD);
+ seekersTeam.setFriendlyFireAllowed(false);
+
+ //set up hidders team
+ hidersTeam = scoreboard.addTeam("Hidders");
+ hidersTeam.setColor(Formatting.BLUE);
+ hidersTeam.setFriendlyFireAllowed(false);
+ hidersTeam.setNameTagVisibilityRule(VisibilityRule.HIDE_FOR_OTHER_TEAMS);
+
// Give items and status effects to everyone playing game
for (ServerPlayerEntity p : players) {
- // Put everyone to full health and hunger and give them night vision on haste until game ends
+ // Put everyone to full health and hunger
p.inventory.clear();
- p.addStatusEffect(new StatusEffectInstance(StatusEffects.NIGHT_VISION, 200000000, 3, false, false));
- p.addStatusEffect(new StatusEffectInstance(StatusEffects.HASTE, 200000000, 1, false, false));
p.addStatusEffect(new StatusEffectInstance(StatusEffects.SATURATION, 300, 100, false, false));
p.heal(20);
// give steak x64
GiveItem.giveMultipleItem(p, "cooked_beef", 2, 64);
- p.setGameMode(GameMode.SURVIVAL);
+ // set everyones gamemode
+ p.setGameMode(GameMode.ADVENTURE);
}
- giveSeekerItems(diggers);
- giveHidersItems(hidders);
-
- ServerWorld world = source.getWorld();
-
- // TODO: FILL AND TP PLAYERS AND CLEAR ALL ITEMS
+ giveSeekerItems(seekers);
+ giveHidersItems(hiders);
return 0;
}
@@ -95,10 +100,15 @@ public class MainModule implements Module {
public int end()
{
for (ServerPlayerEntity p : players) {
+ // resets all effects and inventoty and tp's aeveryone back to spawn
p.teleport(Constants.spawnX, Constants.spawnY, Constants.spawnZ);
p.clearStatusEffects();
p.setGameMode(GameMode.CREATIVE);
p.inventory.clear();
+
+ // removes the teams
+ scoreboard.removeTeam(hidersTeam);
+ scoreboard.removeTeam(seekersTeam);
}
return 0;
}