Improve multi version code & #21

This commit is contained in:
Daniel Saukel 2015-12-30 17:15:08 +01:00
parent 30096fe166
commit b36be75a57
47 changed files with 254 additions and 66 deletions

View File

@ -1,7 +1,7 @@
package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -2,7 +2,7 @@ package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.player.DPlayer;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -1,7 +1,7 @@
package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -3,7 +3,7 @@ package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.player.DPlayer;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;

View File

@ -2,7 +2,7 @@ package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.file.DMessages;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;

View File

@ -2,7 +2,7 @@ package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.global.DPortal;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import java.util.Set;

View File

@ -4,7 +4,7 @@ import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPlayer;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -4,7 +4,7 @@ import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPlayer;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -5,7 +5,7 @@ import java.util.List;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.util.IntegerUtil;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import org.bukkit.command.CommandSender;

View File

@ -2,8 +2,8 @@ package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.UUIDUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import org.bukkit.command.CommandSender;

View File

@ -4,7 +4,7 @@ import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPlayer;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -7,7 +7,7 @@ import io.github.dre2n.dungeonsxl.dungeon.WorldConfig;
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.util.IntegerUtil;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import java.io.File;
import java.util.ArrayList;

View File

@ -2,7 +2,7 @@ package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.player.DPlayer;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;

View File

@ -4,8 +4,8 @@ import java.io.File;
import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.VersionUtil.Internals;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;

View File

@ -4,7 +4,7 @@ import io.github.dre2n.dungeonsxl.dungeon.WorldConfig;
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.util.IntegerUtil;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import java.io.File;

View File

@ -7,7 +7,7 @@ import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPlayer;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import java.io.File;

View File

@ -3,7 +3,7 @@ package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.global.DPortal;
import io.github.dre2n.dungeonsxl.player.DPlayer;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;

View File

@ -2,8 +2,8 @@ package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.VersionUtil.Internals;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import java.io.File;

View File

@ -2,7 +2,7 @@ package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -6,7 +6,7 @@ import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPlayer;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -2,8 +2,8 @@ package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.UUIDUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import org.bukkit.command.CommandSender;

View File

@ -3,7 +3,7 @@ package io.github.dre2n.dungeonsxl.dungeon;
import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.player.DPlayer;
import io.github.dre2n.dungeonsxl.util.FileUtil;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import java.io.File;
import java.io.FileInputStream;

View File

@ -4,7 +4,7 @@ import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPlayer;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import net.milkbowl.vault.item.ItemInfo;
import net.milkbowl.vault.item.Items;

View File

@ -10,7 +10,7 @@ import io.github.dre2n.dungeonsxl.player.DPlayer;
import io.github.dre2n.dungeonsxl.sign.DSign;
import io.github.dre2n.dungeonsxl.trigger.RedstoneTrigger;
import io.github.dre2n.dungeonsxl.util.FileUtil;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import java.io.File;
import java.io.FileInputStream;

View File

@ -5,7 +5,7 @@ import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPlayer;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import org.bukkit.Location;
import org.bukkit.Material;

View File

@ -6,7 +6,7 @@ import io.github.dre2n.dungeonsxl.dungeon.WorldConfig;
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import java.io.File;
import java.util.concurrent.CopyOnWriteArrayList;

View File

@ -4,7 +4,7 @@ import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPlayer;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import org.bukkit.ChatColor;
import org.bukkit.Material;

View File

@ -11,7 +11,7 @@ import io.github.dre2n.dungeonsxl.global.LeaveSign;
import io.github.dre2n.dungeonsxl.sign.DSign;
import io.github.dre2n.dungeonsxl.trigger.RedstoneTrigger;
import io.github.dre2n.dungeonsxl.util.IntegerUtil;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import org.bukkit.Location;
import org.bukkit.Material;

View File

@ -1,7 +1,7 @@
package io.github.dre2n.dungeonsxl.listener;
import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.command.DCommand;
import io.github.dre2n.dungeonsxl.file.DMessages;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;

View File

@ -15,8 +15,8 @@ import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPlayer;
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
import io.github.dre2n.dungeonsxl.trigger.UseItemTrigger;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.MiscUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import org.bukkit.ChatColor;
import org.bukkit.Location;

View File

@ -6,7 +6,7 @@ import io.github.dre2n.dungeonsxl.dungeon.WorldConfig;
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.global.GroupSign;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import java.io.File;
import java.util.ArrayList;

View File

@ -10,8 +10,8 @@ import io.github.dre2n.dungeonsxl.file.DMessages;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.trigger.DistanceTrigger;
import io.github.dre2n.dungeonsxl.util.IntegerUtil;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.MiscUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import java.io.File;
import java.io.IOException;

View File

@ -3,7 +3,7 @@ package io.github.dre2n.dungeonsxl.sign;
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.player.DPlayer;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import java.util.concurrent.CopyOnWriteArrayList;

View File

@ -2,7 +2,7 @@ package io.github.dre2n.dungeonsxl.sign;
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
import io.github.dre2n.dungeonsxl.util.IntegerUtil;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import java.util.concurrent.CopyOnWriteArrayList;

View File

@ -5,7 +5,7 @@ import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
import io.github.dre2n.dungeonsxl.player.DPlayer;
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
import io.github.dre2n.dungeonsxl.util.MessageUtil;
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
import org.bukkit.ChatColor;
import org.bukkit.Material;

View File

@ -1,4 +1,7 @@
package io.github.dre2n.dungeonsxl.util;
package io.github.dre2n.dungeonsxl.util.messageutil;
import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.util.VersionUtil;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -8,6 +11,8 @@ import org.bukkit.plugin.Plugin;
public class MessageUtil {
static VersionUtil versionUtil = DungeonsXL.getPlugin().getVersion();
public enum DefaultFontInfo {
A('A', 5),
@ -205,24 +210,34 @@ public class MessageUtil {
sendCenteredMessage(sender, "&4&l[ &6" + plugin.getDescription().getName() + " &4&l]");
}
public static void sendScreenMessage(Player player, String title, String subtitle, long fadeIn, long show, long fadeOut) {
subtitle = ChatColor.translateAlternateColorCodes('&', subtitle);
title = ChatColor.translateAlternateColorCodes('&', title);
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title " + player.getName() + " time " + fadeIn + " " + show + " " + fadeOut);
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title " + player.getName() + " subtitle " + subtitle);
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title " + player.getName() + " title " + title);
public static void sendScreenMessage(Player player, String title, String subtitle, int fadeIn, int show, int fadeOut) {
switch (versionUtil.getInternals()) {
case v1_8_R1:
v1_8_R1.sendScreenMessage(player, title, subtitle, fadeIn, show, fadeOut);
break;
case v1_8_R2:
v1_8_R2.sendScreenMessage(player, title, subtitle, fadeIn, show, fadeOut);
break;
case v1_8_R3:
v1_8_R3.sendScreenMessage(player, title, subtitle, fadeIn, show, fadeOut);
break;
case v1_9_R1:
v1_9_R1.sendScreenMessage(player, title, subtitle, fadeIn, show, fadeOut);
break;
case UNKNOWN:
UNKNOWN.sendScreenMessage(player, title, subtitle, fadeIn, show, fadeOut);
break;
default:
return;
}
}
public static void sendScreenMessage(Player player, String title, String subtitle) {
subtitle = ChatColor.translateAlternateColorCodes('&', subtitle);
title = ChatColor.translateAlternateColorCodes('&', title);
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title " + player.getName() + " subtitle \"" + subtitle + "\"");
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title " + player.getName() + " title \"" + title + "\"");
sendScreenMessage(player, title, subtitle, 20, 60, 20);
}
public static void sendScreenMessage(Player player, String title) {
title = ChatColor.translateAlternateColorCodes('&', title);
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title " + player.getName() + " title \"" + title + "\"");
sendScreenMessage(player, title, "", 20, 60, 20);
}
public static final String[] BIG_A = {

View File

@ -0,0 +1,29 @@
package io.github.dre2n.dungeonsxl.util.messageutil;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
class UNKNOWN {
static void sendScreenMessage(Player player, String title, String subtitle, long fadeIn, long show, long fadeOut) {
subtitle = ChatColor.translateAlternateColorCodes('&', subtitle);
title = ChatColor.translateAlternateColorCodes('&', title);
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title " + player.getName() + " time " + fadeIn + " " + show + " " + fadeOut);
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title " + player.getName() + " subtitle " + subtitle);
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title " + player.getName() + " title " + title);
}
static void sendScreenMessage(Player player, String title, String subtitle) {
subtitle = ChatColor.translateAlternateColorCodes('&', subtitle);
title = ChatColor.translateAlternateColorCodes('&', title);
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title " + player.getName() + " subtitle " + subtitle);
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title " + player.getName() + " title " + title);
}
public static void sendScreenMessage(Player player, String title) {
title = ChatColor.translateAlternateColorCodes('&', title);
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title " + player.getName() + " title \"" + title + "\"");
}
}

View File

@ -0,0 +1,36 @@
package io.github.dre2n.dungeonsxl.util.messageutil;
import net.minecraft.server.v1_8_R1.IChatBaseComponent;
import net.minecraft.server.v1_8_R1.PacketPlayOutTitle;
import net.minecraft.server.v1_8_R1.PlayerConnection;
import net.minecraft.server.v1_8_R1.ChatSerializer;
import net.minecraft.server.v1_8_R1.EnumTitleAction;
import org.bukkit.ChatColor;
import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
class v1_8_R1 {
static void sendScreenMessage(Player player, String title, String subtitle, int fadeIn, int show, int fadeOut) {
subtitle = ChatColor.translateAlternateColorCodes('&', subtitle);
title = ChatColor.translateAlternateColorCodes('&', title);
IChatBaseComponent subtitleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', subtitle) + "\"}");
IChatBaseComponent titleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', title) + "\"}");
PacketPlayOutTitle clearPacket = new PacketPlayOutTitle(EnumTitleAction.CLEAR, titleComponent);
PacketPlayOutTitle resetPacket = new PacketPlayOutTitle(EnumTitleAction.RESET, titleComponent);
PacketPlayOutTitle subtitlePacket = new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, subtitleComponent);
PacketPlayOutTitle titlePacket = new PacketPlayOutTitle(EnumTitleAction.TITLE, titleComponent);
PacketPlayOutTitle timesPacket = new PacketPlayOutTitle(fadeIn, show, fadeOut);
PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;
connection.sendPacket(clearPacket);
connection.sendPacket(resetPacket);
connection.sendPacket(subtitlePacket);
connection.sendPacket(titlePacket);
connection.sendPacket(timesPacket);
}
}

View File

@ -0,0 +1,36 @@
package io.github.dre2n.dungeonsxl.util.messageutil;
import net.minecraft.server.v1_8_R2.IChatBaseComponent;
import net.minecraft.server.v1_8_R2.PacketPlayOutTitle;
import net.minecraft.server.v1_8_R2.PlayerConnection;
import net.minecraft.server.v1_8_R2.IChatBaseComponent.ChatSerializer;
import net.minecraft.server.v1_8_R2.PacketPlayOutTitle.EnumTitleAction;
import org.bukkit.ChatColor;
import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
import org.bukkit.entity.Player;
class v1_8_R2 {
static void sendScreenMessage(Player player, String title, String subtitle, int fadeIn, int show, int fadeOut) {
subtitle = ChatColor.translateAlternateColorCodes('&', subtitle);
title = ChatColor.translateAlternateColorCodes('&', title);
IChatBaseComponent subtitleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', subtitle) + "\"}");
IChatBaseComponent titleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', title) + "\"}");
PacketPlayOutTitle clearPacket = new PacketPlayOutTitle(EnumTitleAction.CLEAR, titleComponent);
PacketPlayOutTitle resetPacket = new PacketPlayOutTitle(EnumTitleAction.RESET, titleComponent);
PacketPlayOutTitle subtitlePacket = new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, subtitleComponent);
PacketPlayOutTitle titlePacket = new PacketPlayOutTitle(EnumTitleAction.TITLE, titleComponent);
PacketPlayOutTitle timesPacket = new PacketPlayOutTitle(fadeIn, show, fadeOut);
PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;
connection.sendPacket(clearPacket);
connection.sendPacket(resetPacket);
connection.sendPacket(subtitlePacket);
connection.sendPacket(titlePacket);
connection.sendPacket(timesPacket);
}
}

View File

@ -0,0 +1,36 @@
package io.github.dre2n.dungeonsxl.util.messageutil;
import net.minecraft.server.v1_8_R3.IChatBaseComponent;
import net.minecraft.server.v1_8_R3.PacketPlayOutTitle;
import net.minecraft.server.v1_8_R3.PlayerConnection;
import net.minecraft.server.v1_8_R3.IChatBaseComponent.ChatSerializer;
import net.minecraft.server.v1_8_R3.PacketPlayOutTitle.EnumTitleAction;
import org.bukkit.ChatColor;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
class v1_8_R3 {
static void sendScreenMessage(Player player, String title, String subtitle, int fadeIn, int show, int fadeOut) {
subtitle = ChatColor.translateAlternateColorCodes('&', subtitle);
title = ChatColor.translateAlternateColorCodes('&', title);
IChatBaseComponent subtitleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', subtitle) + "\"}");
IChatBaseComponent titleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', title) + "\"}");
PacketPlayOutTitle clearPacket = new PacketPlayOutTitle(EnumTitleAction.CLEAR, titleComponent);
PacketPlayOutTitle resetPacket = new PacketPlayOutTitle(EnumTitleAction.RESET, titleComponent);
PacketPlayOutTitle subtitlePacket = new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, subtitleComponent);
PacketPlayOutTitle titlePacket = new PacketPlayOutTitle(EnumTitleAction.TITLE, titleComponent);
PacketPlayOutTitle timesPacket = new PacketPlayOutTitle(fadeIn, show, fadeOut);
PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;
connection.sendPacket(clearPacket);
connection.sendPacket(resetPacket);
connection.sendPacket(subtitlePacket);
connection.sendPacket(titlePacket);
connection.sendPacket(timesPacket);
}
}

View File

@ -0,0 +1,36 @@
package io.github.dre2n.dungeonsxl.util.messageutil;
import net.minecraft.server.v1_9_R1.IChatBaseComponent;
import net.minecraft.server.v1_9_R1.PacketPlayOutTitle;
import net.minecraft.server.v1_9_R1.PlayerConnection;
import net.minecraft.server.v1_9_R1.IChatBaseComponent.ChatSerializer;
import net.minecraft.server.v1_9_R1.PacketPlayOutTitle.EnumTitleAction;
import org.bukkit.ChatColor;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
class v1_9_R1 {
static void sendScreenMessage(Player player, String title, String subtitle, int fadeIn, int show, int fadeOut) {
subtitle = ChatColor.translateAlternateColorCodes('&', subtitle);
title = ChatColor.translateAlternateColorCodes('&', title);
IChatBaseComponent subtitleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', subtitle) + "\"}");
IChatBaseComponent titleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', title) + "\"}");
PacketPlayOutTitle clearPacket = new PacketPlayOutTitle(EnumTitleAction.CLEAR, titleComponent);
PacketPlayOutTitle resetPacket = new PacketPlayOutTitle(EnumTitleAction.RESET, titleComponent);
PacketPlayOutTitle subtitlePacket = new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, subtitleComponent);
PacketPlayOutTitle titlePacket = new PacketPlayOutTitle(EnumTitleAction.TITLE, titleComponent);
PacketPlayOutTitle timesPacket = new PacketPlayOutTitle(fadeIn, show, fadeOut);
PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;
connection.sendPacket(clearPacket);
connection.sendPacket(resetPacket);
connection.sendPacket(subtitlePacket);
connection.sendPacket(titlePacket);
connection.sendPacket(timesPacket);
}
}

View File

@ -14,9 +14,9 @@ import org.bukkit.craftbukkit.v1_7_R3.CraftServer;
import org.bukkit.craftbukkit.v1_7_R3.CraftWorld;
import org.bukkit.entity.Player;
public class v1_7_R3 {
class v1_7_R3 {
public static Player getOfflinePlayer(String player, UUID uuid) {
static Player getOfflinePlayer(String player, UUID uuid) {
Player pplayer = null;
try {
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
@ -43,7 +43,7 @@ public class v1_7_R3 {
return pplayer;
}
public static Player getOfflinePlayer(String player, UUID uuid, Location location) {
static Player getOfflinePlayer(String player, UUID uuid, Location location) {
Player pplayer = null;
try {
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");

View File

@ -14,9 +14,9 @@ import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.entity.Player;
public class v1_7_R4 {
class v1_7_R4 {
public static Player getOfflinePlayer(String player, UUID uuid) {
static Player getOfflinePlayer(String player, UUID uuid) {
Player pplayer = null;
try {
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
@ -43,7 +43,7 @@ public class v1_7_R4 {
return pplayer;
}
public static Player getOfflinePlayer(String player, UUID uuid, Location location) {
static Player getOfflinePlayer(String player, UUID uuid, Location location) {
Player pplayer = null;
try {
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");

View File

@ -15,9 +15,9 @@ import org.bukkit.entity.Player;
import com.mojang.authlib.GameProfile;
public class v1_8_R1 {
class v1_8_R1 {
public static Player getOfflinePlayer(String player, UUID uuid) {
static Player getOfflinePlayer(String player, UUID uuid) {
Player pplayer = null;
try {
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
@ -44,7 +44,7 @@ public class v1_8_R1 {
return pplayer;
}
public static Player getOfflinePlayer(String player, UUID uuid, Location location) {
static Player getOfflinePlayer(String player, UUID uuid, Location location) {
Player pplayer = null;
try {
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");

View File

@ -15,9 +15,9 @@ import org.bukkit.entity.Player;
import com.mojang.authlib.GameProfile;
public class v1_8_R2 {
class v1_8_R2 {
public static Player getOfflinePlayer(String player, UUID uuid) {
static Player getOfflinePlayer(String player, UUID uuid) {
Player pplayer = null;
try {
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
@ -44,7 +44,7 @@ public class v1_8_R2 {
return pplayer;
}
public static Player getOfflinePlayer(String player, UUID uuid, Location location) {
static Player getOfflinePlayer(String player, UUID uuid, Location location) {
Player pplayer = null;
try {
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");

View File

@ -15,9 +15,9 @@ import org.bukkit.entity.Player;
import com.mojang.authlib.GameProfile;
public class v1_8_R3 {
class v1_8_R3 {
public static Player getOfflinePlayer(String player, UUID uuid) {
static Player getOfflinePlayer(String player, UUID uuid) {
Player pplayer = null;
try {
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
@ -44,7 +44,7 @@ public class v1_8_R3 {
return pplayer;
}
public static Player getOfflinePlayer(String player, UUID uuid, Location location) {
static Player getOfflinePlayer(String player, UUID uuid, Location location) {
Player pplayer = null;
try {
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");

View File

@ -15,9 +15,9 @@ import org.bukkit.entity.Player;
import com.mojang.authlib.GameProfile;
public class v1_9_R1 {
class v1_9_R1 {
public static Player getOfflinePlayer(String player, UUID uuid) {
static Player getOfflinePlayer(String player, UUID uuid) {
Player pplayer = null;
try {
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
@ -44,7 +44,7 @@ public class v1_9_R1 {
return pplayer;
}
public static Player getOfflinePlayer(String player, UUID uuid, Location location) {
static Player getOfflinePlayer(String player, UUID uuid, Location location) {
Player pplayer = null;
try {
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");