Skip to content

Commit 0e58920

Browse files
committed
各サーバーへ参加できるように
1 parent b1c5d75 commit 0e58920

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+385
-282
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package com.github.elic0de.thejpspit.bungee;
2+
3+
import com.google.common.io.ByteArrayDataInput;
4+
import com.google.common.io.ByteArrayDataOutput;
5+
import com.google.common.io.ByteStreams;
6+
import java.util.Collection;
7+
import net.md_5.bungee.api.config.ServerInfo;
8+
import net.md_5.bungee.api.event.PluginMessageEvent;
9+
import net.md_5.bungee.api.plugin.Listener;
10+
import net.md_5.bungee.event.EventHandler;
11+
12+
13+
14+
public class RequestReceiveListener implements Listener {
15+
16+
private final TheJpsPit plugin = TheJpsPit.getInstance();
17+
18+
@EventHandler
19+
public void on(PluginMessageEvent event) {
20+
if (!event.getTag().equals("BungeeCord")) return;
21+
22+
ByteArrayDataInput in = ByteStreams.newDataInput(event.getData());
23+
if (!in.readUTF().equals("TheJpsPit:request")) return;
24+
25+
ByteArrayDataOutput out = ByteStreams.newDataOutput();
26+
out.writeUTF("TheJpsPit:response");
27+
28+
Collection<ServerInfo> servers = plugin.getProxy().getServers().values();
29+
out.writeInt(servers.size());
30+
for (ServerInfo server : servers) {
31+
out.writeUTF(server.getName());
32+
out.writeInt(server.getPlayers().size());
33+
}
34+
35+
for (ServerInfo server : plugin.getProxy().getServers().values()) {
36+
server.sendData("BungeeCord", out.toByteArray());
37+
}
38+
}
39+
40+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.github.elic0de.thejpspit.bungee;
2+
3+
import net.md_5.bungee.api.plugin.Plugin;
4+
5+
public class TheJpsPit extends Plugin {
6+
7+
private static TheJpsPit instance;
8+
9+
@Override
10+
public void onEnable() {
11+
instance = this;
12+
13+
getProxy().registerChannel("BungeeCord");
14+
getProxy().getPluginManager().registerListener(this, new RequestReceiveListener());
15+
}
16+
17+
@Override
18+
public void onDisable() {
19+
getProxy().unregisterChannel("BungeeCord");
20+
}
21+
22+
public static TheJpsPit getInstance() {
23+
return instance;
24+
}
25+
26+
}

src/main/java/com/github/elic0de/thejpspit/gui/ItemMenu.java

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/main/java/com/github/elic0de/thejpspit/gui/UpgradeMenu.java

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/main/java/com/github/elic0de/thejpspit/player/Preferences.java

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/main/java/com/github/elic0de/thejpspit/queue/QueueManager.java

Lines changed: 0 additions & 77 deletions
This file was deleted.

src/main/java/com/github/elic0de/thejpspit/TheJpsPit.java renamed to src/main/java/com/github/elic0de/thejpspit/spigot/TheJpsPit.java

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
package com.github.elic0de.thejpspit;
1+
package com.github.elic0de.thejpspit.spigot;
22

33
import co.aikar.commands.PaperCommandManager;
44
import com.fatboyindustrial.gsonjavatime.Converters;
5-
import com.github.elic0de.thejpspit.command.PitCommand;
6-
import com.github.elic0de.thejpspit.command.SpawnCommand;
7-
import com.github.elic0de.thejpspit.config.PitPreferences;
8-
import com.github.elic0de.thejpspit.database.Database;
9-
import com.github.elic0de.thejpspit.database.SqLiteDatabase;
10-
import com.github.elic0de.thejpspit.game.Game;
11-
import com.github.elic0de.thejpspit.hook.EconomyHook;
12-
import com.github.elic0de.thejpspit.hook.Hook;
13-
import com.github.elic0de.thejpspit.hook.VaultEconomyHook;
14-
import com.github.elic0de.thejpspit.item.ItemManager;
15-
import com.github.elic0de.thejpspit.item.items.ItemDiamondBoots;
16-
import com.github.elic0de.thejpspit.item.items.ItemDiamondChestPlate;
17-
import com.github.elic0de.thejpspit.item.items.ItemDiamondSword;
18-
import com.github.elic0de.thejpspit.item.items.ItemObsidian;
19-
import com.github.elic0de.thejpspit.listener.CombatTagger;
20-
import com.github.elic0de.thejpspit.listener.EventListener;
21-
import com.github.elic0de.thejpspit.network.PluginMessageReceiver;
22-
import com.github.elic0de.thejpspit.nms.PacketManager;
23-
import com.github.elic0de.thejpspit.nms.PacketManager1_19_R1;
24-
import com.github.elic0de.thejpspit.player.PitPlayer;
25-
import com.github.elic0de.thejpspit.player.PitPlayerManager;
26-
import com.github.elic0de.thejpspit.queue.QueueManager;
27-
import com.github.elic0de.thejpspit.task.QueueTask;
28-
import com.github.elic0de.thejpspit.util.KillAssistHelper;
29-
import com.github.elic0de.thejpspit.util.KillRatingHelper;
30-
import com.github.elic0de.thejpspit.villager.VillagerNPCManager;
31-
import com.github.elic0de.thejpspit.villager.villagers.ShopVillager;
5+
import com.github.elic0de.thejpspit.spigot.command.PitCommand;
6+
import com.github.elic0de.thejpspit.spigot.command.SpawnCommand;
7+
import com.github.elic0de.thejpspit.spigot.config.PitPreferences;
8+
import com.github.elic0de.thejpspit.spigot.database.Database;
9+
import com.github.elic0de.thejpspit.spigot.database.SqLiteDatabase;
10+
import com.github.elic0de.thejpspit.spigot.game.Game;
11+
import com.github.elic0de.thejpspit.spigot.hook.EconomyHook;
12+
import com.github.elic0de.thejpspit.spigot.hook.Hook;
13+
import com.github.elic0de.thejpspit.spigot.hook.VaultEconomyHook;
14+
import com.github.elic0de.thejpspit.spigot.item.ItemManager;
15+
import com.github.elic0de.thejpspit.spigot.item.items.ItemDiamondBoots;
16+
import com.github.elic0de.thejpspit.spigot.item.items.ItemDiamondChestPlate;
17+
import com.github.elic0de.thejpspit.spigot.item.items.ItemDiamondSword;
18+
import com.github.elic0de.thejpspit.spigot.item.items.ItemObsidian;
19+
import com.github.elic0de.thejpspit.spigot.listener.CombatTagger;
20+
import com.github.elic0de.thejpspit.spigot.listener.EventListener;
21+
import com.github.elic0de.thejpspit.spigot.network.PluginMessageReceiver;
22+
import com.github.elic0de.thejpspit.spigot.nms.PacketManager;
23+
import com.github.elic0de.thejpspit.spigot.nms.PacketManager1_19_R1;
24+
import com.github.elic0de.thejpspit.spigot.player.PitPlayer;
25+
import com.github.elic0de.thejpspit.spigot.player.PitPlayerManager;
26+
import com.github.elic0de.thejpspit.spigot.queue.QueueManager;
27+
import com.github.elic0de.thejpspit.spigot.task.QueueTask;
28+
import com.github.elic0de.thejpspit.spigot.util.KillAssistHelper;
29+
import com.github.elic0de.thejpspit.spigot.util.KillRatingHelper;
30+
import com.github.elic0de.thejpspit.spigot.villager.VillagerNPCManager;
31+
import com.github.elic0de.thejpspit.spigot.villager.villagers.ShopVillager;
3232
import com.google.gson.Gson;
3333
import com.google.gson.GsonBuilder;
3434
import org.bukkit.Bukkit;
@@ -91,12 +91,11 @@ public void onEnable() {
9191
assistKillHelper = new KillAssistHelper();
9292
ratingHelper = new KillRatingHelper(0);
9393
queueManager = new QueueManager();
94+
queueTask = new QueueTask();
9495

9596
setPreferences();
9697
setPacketManager();
9798

98-
//queueTask = new QueueTask();
99-
10099
getServer().getMessenger()
101100
.registerIncomingPluginChannel(this, PluginMessageReceiver.BUNGEE_CHANNEL_ID,
102101
new PluginMessageReceiver());
@@ -201,7 +200,7 @@ public void onDisable() {
201200
}
202201
game.getTask().stop();
203202

204-
//queueTask.stop();
203+
queueTask.stop();
205204

206205
getServer().getMessenger().unregisterOutgoingPluginChannel(this);
207206
getServer().getMessenger().unregisterIncomingPluginChannel(this);

src/main/java/com/github/elic0de/thejpspit/command/PitCommand.java renamed to src/main/java/com/github/elic0de/thejpspit/spigot/command/PitCommand.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
package com.github.elic0de.thejpspit.command;
1+
package com.github.elic0de.thejpspit.spigot.command;
22

33
import co.aikar.commands.BaseCommand;
44
import co.aikar.commands.annotation.CommandAlias;
55
import co.aikar.commands.annotation.CommandPermission;
66
import co.aikar.commands.annotation.Optional;
77
import co.aikar.commands.annotation.Subcommand;
88
import co.aikar.commands.bukkit.contexts.OnlinePlayer;
9-
import com.github.elic0de.thejpspit.TheJpsPit;
10-
import com.github.elic0de.thejpspit.player.PitPlayer;
11-
import com.github.elic0de.thejpspit.player.PitPlayerManager;
12-
import com.github.elic0de.thejpspit.villager.VillagerNPCManager;
9+
import com.github.elic0de.thejpspit.spigot.TheJpsPit;
10+
import com.github.elic0de.thejpspit.spigot.player.PitPlayer;
11+
import com.github.elic0de.thejpspit.spigot.player.PitPlayerManager;
12+
import com.github.elic0de.thejpspit.spigot.villager.VillagerNPCManager;
1313
import org.bukkit.entity.Player;
1414

1515
@CommandAlias("pit|tjp|p")

src/main/java/com/github/elic0de/thejpspit/command/SpawnCommand.java renamed to src/main/java/com/github/elic0de/thejpspit/spigot/command/SpawnCommand.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
package com.github.elic0de.thejpspit.command;
1+
package com.github.elic0de.thejpspit.spigot.command;
22

33
import co.aikar.commands.BaseCommand;
44
import co.aikar.commands.annotation.CommandAlias;
5-
import com.github.elic0de.thejpspit.TheJpsPit;
6-
import com.github.elic0de.thejpspit.listener.CombatTagger;
7-
import com.github.elic0de.thejpspit.player.PitPlayer;
8-
import com.github.elic0de.thejpspit.player.PitPlayerManager;
5+
import com.github.elic0de.thejpspit.spigot.TheJpsPit;
6+
import com.github.elic0de.thejpspit.spigot.listener.CombatTagger;
7+
import com.github.elic0de.thejpspit.spigot.player.PitPlayer;
8+
import com.github.elic0de.thejpspit.spigot.player.PitPlayerManager;
99
import org.bukkit.entity.Player;
1010

1111
public class SpawnCommand extends BaseCommand {

src/main/java/com/github/elic0de/thejpspit/config/PitPreferences.java renamed to src/main/java/com/github/elic0de/thejpspit/spigot/config/PitPreferences.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.github.elic0de.thejpspit.config;
1+
package com.github.elic0de.thejpspit.spigot.config;
22

33
import com.google.gson.annotations.Expose;
44
import com.google.gson.annotations.SerializedName;

0 commit comments

Comments
 (0)