Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2J_Server_BETA14
- Index: java/com/l2jserver/gameserver/GameServer.java
- ===================================================================
- --- java/com/l2jserver/gameserver/GameServer.java (revision 6212)
- +++ java/com/l2jserver/gameserver/GameServer.java (working copy)
- @@ -40,6 +40,7 @@
- import com.l2jserver.gameserver.datatables.AdminTable;
- import com.l2jserver.gameserver.datatables.ArmorSetsData;
- import com.l2jserver.gameserver.datatables.AugmentationData;
- +import com.l2jserver.gameserver.datatables.BalanceData;
- import com.l2jserver.gameserver.datatables.BotReportTable;
- import com.l2jserver.gameserver.datatables.BuyListData;
- import com.l2jserver.gameserver.datatables.CategoryData;
- @@ -121,6 +122,7 @@
- import com.l2jserver.gameserver.instancemanager.TerritoryWarManager;
- import com.l2jserver.gameserver.instancemanager.WalkingManager;
- import com.l2jserver.gameserver.instancemanager.ZoneManager;
- +import com.l2jserver.gameserver.model.Announce;
- import com.l2jserver.gameserver.model.AutoSpawnHandler;
- import com.l2jserver.gameserver.model.L2World;
- import com.l2jserver.gameserver.model.PartyMatchRoomList;
- @@ -206,6 +208,7 @@
- printSection("Engines");
- L2ScriptEngineManager.getInstance();
- + new Announce().getInstance();
- printSection("World");
- // start game time control early
- GameTimeController.init();
- Index: java/com/l2jserver/gameserver/model/Announce.java
- ===================================================================
- --- java/com/l2jserver/gameserver/model/Announce.java (revision 0)
- +++ java/com/l2jserver/gameserver/model/Announce.java (revision 0)
- @@ -0,0 +1,76 @@
- +/*
- + * Copyright (C) 2004-2013 L2J Server
- + *
- + * This file is part of L2J Server.
- + *
- + * L2J Server is free software: you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation, either version 3 of the License, or
- + * (at your option) any later version.
- + *
- + * L2J Server is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- + * General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with this program. If not, see <http://www.gnu.org/licenses/>.
- + */
- +package com.l2jserver.gameserver.model;
- +
- +import java.io.BufferedReader;
- +import java.io.InputStreamReader;
- +import java.net.URL;
- +import java.net.URLConnection;
- +
- +import com.l2jserver.gameserver.Announcements;
- +import com.l2jserver.gameserver.ThreadPoolManager;
- +
- +/**
- + * @author Marwan
- + */
- +public class Announce
- +{
- + int time;
- + String text;
- + String websiteURL = "http://l2leaders.comoj.com/announce";
- +
- + public void getAnnounce()
- + {
- +
- + try
- + {
- + URL announce = new URL(websiteURL);
- + URLConnection connection = announce.openConnection();
- + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
- + String inputLine;
- + while ((inputLine = in.readLine()) != null)
- + {
- + text = inputLine.split("|")[0];
- + time = Integer.parseInt(inputLine.split("|")[1]);
- + }
- + in.close();
- + }
- + catch (Exception e)
- + {
- + e.printStackTrace();
- + }
- +
- + }
- +
- + public class Announce2 implements Runnable
- + {
- + @Override
- + public void run()
- + {
- + Announcements.getInstance().announceToAll(text);
- + getInstance();
- + }
- + }
- +
- + public void getInstance()
- + {
- + getAnnounce();
- + ThreadPoolManager.getInstance().scheduleGeneral(new Announce2(), time * 1000);
- + }
- +}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement