1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
package los.numeros.EPHS.modules;
import los.numeros.GameEngine.Module;
import los.numeros.utils.GiveItem;
import net.minecraft.enchantment.Enchantments;
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.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.GameMode;
import los.numeros.EPHS.Constants;
public class MainModule implements Module {
ServerPlayerEntity[] diggers, hidders, players;
ServerCommandSource source;
public MainModule(ServerPlayerEntity[] diggers, ServerPlayerEntity[] hidders, ServerPlayerEntity[] players, ServerCommandSource source) {
this.diggers = diggers;
this.hidders = hidders;
this.players = players;
this.source = source;
}
public void giveSeekerItems(ServerPlayerEntity[] diggers) {
for (ServerPlayerEntity p : diggers) {
// 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);
ItemStack sword = GiveItem.getItem("iron_sword");
sword.addEnchantment(Enchantments.SHARPNESS, 1);
// make sword unbreakable
NbtCompound sTag = sword.getTag();
sTag.putBoolean("Unbreakable", true);
sword.setTag(sTag);
p.equip(0, sword);
// 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);
p.teleport(Constants.hidersSpawnX, Constants.hidersSpawnY, Constants.hidersSpawnZ);
}
}
@Override
public int init()
{
// 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
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);
}
giveSeekerItems(diggers);
giveHidersItems(hidders);
ServerWorld world = source.getWorld();
// TODO: FILL AND TP PLAYERS AND CLEAR ALL ITEMS
return 0;
}
@Override
public int end()
{
for (ServerPlayerEntity p : players) {
p.teleport(Constants.spawnX, Constants.spawnY, Constants.spawnZ);
p.clearStatusEffects();
p.setGameMode(GameMode.CREATIVE);
p.inventory.clear();
}
return 0;
}
}
|